Splunk Search

How to get top10 for each span in a time chart?

cwinkler109
New Member

Hello. I'm trying to create a bar chart visualization that shows the top10 eventId's by count for each day over the past 7 days.

The search I have is returning more than 10 results per day.

index=myindex earliest=-7d latest=now | timechart span=1d count by eventId where top10

I see similar questions posted on answers.splunk.com but none of the posts provide a clear answer.

Thanks in advance.

Labels (1)
Tags (2)
0 Karma

cwinkler109
New Member

This gives me what I was looking for:

index=myindex earliest=-7d latest=now
| eval date=strftime(_time, "%Y-%m-%d")
| top 10 eventId by date
| chart useother=0 values(count) over date by eventId where top100

0 Karma

nu_learner
Explorer

Thank you @cwinkler109 - your answer helped me as well!

cwinkler109
New Member

I tried the recommended approach in that post but it returns the same 10 eventId's for every day in the span. In other words, yesterdays top 10 eventId's should be different than todays. The query outputs the same eventsId's for each each day which is not showing the data I am looking for.

index=myindex earliest=-7d latest=now | timechart span=1d count useother=f usenull=f by eventId WHERE max in top10

I'll keep investigating.....

0 Karma

adonio
Ultra Champion
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

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 ...