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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...