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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...