Splunk Search

timechart but only for the top 5

hartfoml
Motivator

I want to use timechart to show a graph of the progress of an item so I use this command

| timechart span=1w count by plugin

the problem is I have too many plugins. I want to limit the chart to only the top 5 plugin's over the time period

So something like this but this dosn't work

| timecart span=1w top 5 plugin

Anyone know how to use top with timechart ??

Tags (1)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee
| timecart span=1w limit=5 useother=f count by plugin

View solution in original post

hartfoml
Motivator

I got it thanks the right syntax to use for this is

| timechart useother=F span=1w limit=5 count by plugin

this says to useother=false so that other is not on the chart and the limit is 5

0 Karma

sbattista09
Contributor

would limit=5 show you the top 5 "plugin" or only limit it to some random 5 "plugins"? as in, would it show you the highest 5 counts of a "plugin"?

msquicc
Path Finder

I know this is a pretty old post, but wanted to put this here for anyone else looking.  This has bothered me for some time.  

It seems timechart, as of some version, supports 3 limit options:

limit=N

limit=topN

limit=bottomN

https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timechart

PickleRick
SplunkTrust
SplunkTrust

limit=N is the same as limit=topN

And the bottomN appeared in 8.1, which was several years ago 🙂

0 Karma

gkanapathy
Splunk Employee
Splunk Employee
| timecart span=1w limit=5 useother=f count by plugin

hartfoml
Motivator

thanks you beet me to it

0 Karma

kbrown9392
New Member

This does not seem to chart the top list, but a random list of 5. They are not the "top 5" in count, and not in order by count. How do we do that?

0 Karma

imrago
Contributor

You could try to use subsearch:

http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork

Something like this:

index=* [search index=* | stats count by plugin | sort - count | head 5 | fields + plugin] | timechart span=1w count by plugin

0 Karma

hartfoml
Motivator

I'm going to try this to see how it comes out

0 Karma

hartfoml
Motivator

OK so i found out that LIMIT reduces to the top "n" number of items like this

 | timechart span=1w limit=5 count by plugin

this gives me the top 5 but puts in the other field with all the ones not in the top 5.

Anyone know how to not show other in the chart???

0 Karma

jtrimmings
Engager

useother=f

0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...