Splunk Search

How to search and calculate the average for the top 70 percent of a field?

bkcstone
Engager

How to calculate the average for top 70%. A field in log contains a value. I need to ignore the least 30% and then calculate average.

Tags (3)
1 Solution

strive
Influencer

Try this

some search terms.. | sort 0 - Field_Of_Interest | streamstats count as Rank | eventstats count as TotalRows | where Rank<(TotalRows * 0.7) | stats avg(Field_Of_Interest) as Required_Average

View solution in original post

strive
Influencer

Try this

some search terms.. | sort 0 - Field_Of_Interest | streamstats count as Rank | eventstats count as TotalRows | where Rank<(TotalRows * 0.7) | stats avg(Field_Of_Interest) as Required_Average
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...