Splunk Search

grouping by a log column

toby53
New Member

How can I do a group by on a log column.
For example:
for fore:
28.02.2014 18:08:30.841 ERROR [pool-6-thread-14-com/zz/zz/replication/job/webserver1(com/zz/zz/replication/job/webserver1)]

I would like to group on [pool-6-thread-14-com/zz/zz/replication/job/webserver1(com/zz/zz/replication/job/webserver1)]with a count of occurrences. Like a group by in a relational database.
thanks

Tags (1)
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi toby53,

First create a field extraction and use this field to group/stats on it. Assuming all your evnts for this new field starts with [ and ends with ] you can do something like this:

.... | rex "\s\[(?<myField>.*)\]" | stats count by myField

Hope this helps ...

Cheers, MuS

0 Karma

MuS
SplunkTrust
SplunkTrust

You're welcome, please accept the answer in this case thanks

0 Karma

toby53
New Member

thanks - works great ! We get thousands of log messages.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...