Splunk Search

Using top to get count and percentage by subgroup

mschellhouse
Path Finder

I am using the following code to get a count and percentage breakdown by x and y. I would like the percent returned to be within the subgroup of x rather than percent of the total population.

top limit=0 x y

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

your base search | stats count by x y | eventstats sum(count) as total by x | eval perc=count*100/total | sort 0 host -count

View solution in original post

somesoni2
Revered Legend

Try like this

your base search | stats count by x y | eventstats sum(count) as total by x | eval perc=count*100/total | sort 0 host -count
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...