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