Splunk Cloud Platform

i need to extract errorMessage. Can anyone of you ...

vineela
Path Finder

2024-07-16T10:59:41.259Z eff08259-3379-5637-b5fe-dd4967aee355 ERROR Invoke Error {"errorType":"Error","errorMessage":"Required Message Attribute [EventTimestamp] is missing","errorCode":_ERROR","name":"Error","stack":["Error: Required Message Attribute [EventTimestamp] is missing"," at throwRequiredParameterError 

In the above log i need to extract errorMessage which was highlighted....Can anyone of you please help me in writing regex for the same.

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This regex will extract the highlighted text

(?<msg>"errorMessage":"[^"]+")
---
If this reply helps you, Karma would be appreciated.
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Of course assuming you don't have any escaped quote in your error string. That's the problem with

1) Manipulating structured data with regexes

2) Sending structured data (json, xml) as part of an otherwise unstructured event.

So generally, it should work but be aware that there might be border cases where it will not capture whole message. This captures with possible escaped quotes:

(?<msg>"errorMessage":".*?(?<!\\)")
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...