Splunk Search

Count occurrence of message in table

Nilesh067
Explorer

I have a message feild having below data 

 

message=Successfully created  customer id XXXX

message =Duplicate create  customer id XXXX

message=Error while create customer id XXXX

message=Successfully updated customer id XXXX

message=Error while updating  customer id  XXXX

 

can we display it in the below format.

Message                                                               Count

Successfully created  customer id              1

Duplicate create  customer id                        1

Error while create customer id                       1

Successfully updated customer id                1 

Error while updating  customer id                  1

 

if not found the count must be 0

 

 

Labels (6)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex field=message "(?<type>(Successfully created|Duplicate create|Error while create|Successfully updated|Error while updating) customer id)"
| stats count by type
| append [| makeresults | eval type="Successfuly created customer id", count=0 | fields type, count ]
| append [| makeresults | eval type="Duplicate create customer id", count=0 | fields type, count ]
| append [| makeresults | eval type="Error while create customer id", count=0 | fields type, count ]
| append [| makeresults | eval type="Successfully updated customer id", count=0 | fields type, count ]
| append [| makeresults | eval type="Error while updating customer id", count=0 | fields type, count ]
| stats sum(count) as count by type​
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...