Splunk Search

How to get the head K of each index in a Splunk search?

lys1030
Explorer

My stats contain an entry called "index". How to get the head K of each index type? For example I want the top 10 in index=a, plus the top 10 in index=b, etc.

Tags (4)
0 Karma

woodcock
Esteemed Legend

You need a thing to "top" by. For example, to see the top sourcetypes by index, do this:

index=* | top sourcetype by index
0 Karma

woodcock
Esteemed Legend

If you need the 10 most recent events by index, you can do this:

index=* | streamstats current=t count by index | where count<=10 | stats list(_raw) by index
0 Karma
Get Updates on the Splunk Community!

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

&#x1f342; Fall into November with a fresh lineup of Community Office Hours, Tech Talks, and Webinars we’ve ...

Transform your security operations with Splunk Enterprise Security

Hi Splunk Community, Splunk Platform has set a great foundation for your security operations. With the ...

Splunk Admins and App Developers | Earn a $35 gift card!

Splunk, in collaboration with ESG (Enterprise Strategy Group) by TechTarget, is excited to announce a ...