Splunk Search

Top percentage out of total events

Yancy
Path Finder

When using the fields sidebar, I can see how often a field appears out of my total result set (ie Appears in 62% of results), and how often the top values of that field appear in the results.

When I use the top command, I can see how often these values appear out of the total number of events that contain that field.

How can I obtain statistics similar how the field sidebar presents them, as a percentage of the total result set?

In my use case I have UserAgent split out to multiple fields and want to know what are the top UserAgents across our total traffic.

Tags (2)
0 Karma
1 Solution

Ron_Naken
Splunk Employee
Splunk Employee

Here are a couple working options to help with ideas (replace ... with your search):

... | eventstats count AS total | stats first(total) AS total count AS c by UserAgent | eval  perc=(c/total)*100 | fields - total | sort - perc | head 10

or

... | eventstats count AS total | chart eval(count/first(total)) AS perc BY UserAgent | sort - perc

View solution in original post

Ron_Naken
Splunk Employee
Splunk Employee

Here are a couple working options to help with ideas (replace ... with your search):

... | eventstats count AS total | stats first(total) AS total count AS c by UserAgent | eval  perc=(c/total)*100 | fields - total | sort - perc | head 10

or

... | eventstats count AS total | chart eval(count/first(total)) AS perc BY UserAgent | sort - perc
Get Updates on the Splunk Community!

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...

Video | Tom’s Smartness Journey Continues

Remember Splunk Community member Tom Kopchak? If you caught the first episode of our Smartness interview ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud? Learn how unique features like ...