Splunk Search

Extract Error Message String

mkulicke
Explorer

I am trying to extract the messages of a commonly used error log:

 

Creating review recommendations service case activity with errorMessage:  example message one here

Creating review recommendations service case activity with errorMessage:  example message two over here 

 

I want to do some graphing of counts of the totals of each individual message, so would like to extract the string and stats count by message. Having trouble extracting the string. How do I do this cleanly? The goal would be to have results for

"example message one here" :  X number of results

"example message two over here": Y number of results

Labels (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You can use the rex command to extract the message text into a field and then use stats to count them.

... | rex "errorMessage: (?<message>.*)"
| stats count by message

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

You can use the rex command to extract the message text into a field and then use stats to count them.

... | rex "errorMessage: (?<message>.*)"
| stats count by message

 

---
If this reply helps you, Karma would be appreciated.

mkulicke
Explorer

Perfect, thank you. I was just having trouble extracting the full sentence with my regex, but this solved it perfectly.

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...