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!

Stay Connected: Your Guide to July Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...