Splunk Search

Consolidating portion of a field before counting

spetzd1
Engager

So, I have a very basic report I am trying to generate that takes an extracted field called MatchesFound and sums up how many of each value it sees:

...| stats count as total by MatchesFound

The result looks something like:

MatchesFound  |   total
1             |    34
2             |    15
3             |    12
5             |    7
6             |    1
7             |    4
9             |    6

The problem I have is that I would like to group some of the MatchesFound together, so that the list goes from 1 through 5 and then has every MatchCount of 6 or higher grouped together. The final table should look something like:

MatchesFound  |   total
1             |    34
2             |    15
3             |    12
5             |    7
6  +          |    11
0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

...| stats count as total by MatchesFound | eval MatchesFound=if(MatchesFound>=6,"6+",MatchesFound)  | stats sum(total) as total by MatchesFound

View solution in original post

somesoni2
Revered Legend

Try something like this

...| stats count as total by MatchesFound | eval MatchesFound=if(MatchesFound>=6,"6+",MatchesFound)  | stats sum(total) as total by MatchesFound

spetzd1
Engager

Worked like a charm. Thank you!

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 ...