Splunk IT Service Intelligence

Filter Timechart Fields by Count

logankinman99
Path Finder

So I'm trying to write a query that allows for displaying a timechart after I've filtered fields by count using stats.
I've been able to filter fields by their counts with this...
host=server1 | stats count by errorName | where count > 250
...which does exactly what I want, returning only the errors that have occurred more than 250 times in the given time period.

What I cannot figure out, however, is how to take that and make a visualization out of it. If I change stats to timechart, it does not work. And neither does adding a timechart count after the where clause.
Any ideas would be very helpful!

Thanks,
Logan

0 Karma
1 Solution

adonio
Ultra Champion

| stats ... strips all fields that arent specifically defined either in the functions / attributes section or after the by clause ...
try something like this:

host = server1 | bin _time span=5m | stats count as error_count by errorName _time | where error_count > 250 | timechart span=30m avg(error_count) as avg_error_count by errorName

View solution in original post

adonio
Ultra Champion

| stats ... strips all fields that arent specifically defined either in the functions / attributes section or after the by clause ...
try something like this:

host = server1 | bin _time span=5m | stats count as error_count by errorName _time | where error_count > 250 | timechart span=30m avg(error_count) as avg_error_count by errorName

logankinman99
Path Finder

Hey, this worked pretty well! Thanks!

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