Splunk Search

How to combine counts within a search?

bro_coded101
Loves-to-Learn Lots

My current search is:

`index`
| search source="Main Source" | fields identifier, status_label
| chart count over identifier by status_label

 

My output statistics for this search looks like this

Identifier | F1 | F2 | F3 | F4 | F5

ID_1          | 6   | 4    | 3    | 2   |   0

ID_2          | 0   | 3    | 7    | 9   |   4

 

I need to combine F1, F3, and F4 as Total_1 and F2 + F5 as Total_2 for each identifier.

I only want my table to show Identifier, Total_1, and Total_2

Is this possible?

Labels (1)
0 Karma

andrew_nelson
Communicator

You should be able to add an eval after your chart. 

| eval Total_1=F1+F3+F4, Total_2=F2+F5 
| table identifier Total_1 Total_2

0 Karma

bro_coded101
Loves-to-Learn Lots

When I use that eval the returning table no longer shows a numerical count. Instead, it shows text such as 

ID_1   |   F1F3    |      F2  

0 Karma

andrew_nelson
Communicator

Are your status labels actually numbers ? 

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...