Splunk Search

How do I write a search to find the top 10 max by field?

SAPrabhakar
Explorer

I am attempting to get a listing of the max top 10 by a field.

I am able to get the the top 10 by doing this:

[search goes here] | top limit=10 message.facets.duration

I can get the max by doing:

[search goes here]  | stats max(message.facets.duration)

I am trying to figure out how to get the max top 10.

0 Karma
1 Solution

somesoni2
Revered Legend

How about this

[search goes here] | sort 10 -message.facets.duration

View solution in original post

somesoni2
Revered Legend

How about this

[search goes here] | sort 10 -message.facets.duration

SAPrabhakar
Explorer

Yea that did the trick. I over thought by quite a bit. Thanks

0 Karma

twinspop
Influencer

top gives you the top occurrences of a field value. So if your duration field had "1" as a value more times than values of "100000", "1" would be the top entry. Probably not what you wanted! 🙂

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...