Splunk Search

after bucketing, how to search/look for a threshold?

tedder
Communicator

The following tells me how many events I'm indexing every 5 minutes.

index="_internal" group="thruput" | bucket _time span=5m | timechart span=5m sum(instantaneous_eps) as ieps

I'd really like to finish this with a threshold, like this:

index="_internal" group="thruput" | bucket _time span=5m | timechart span=5m sum(instantaneous_eps) as ieps | ieps < 5000

..except that doesn't work.

Tags (1)
0 Karma
1 Solution

Lowell
Super Champion

First off, you don't need "bucket" when you are using timechart. You really only need "bucket" when you are using "chart" or "stats" and you need to do something fancy that you can't do with "timechart" out of the box; which is pretty rare.)

Looks like a "where" is all you are missing. Try this:

index="_internal" group="thruput" | timechart span=5m sum(instantaneous_eps) as ieps | where ieps < 5000

You can technically use a "where" clause directly in your timechart command, but you have to use a split-by clause for this to work. (I'm not 100% sure what the advantage is to doing this over simply using the where search command, but it's a viable option in any case.)

index="_internal" group="thruput" | timechart span=5m sum(instantaneous_eps) as ieps by host where ieps < 5000

View solution in original post

Lowell
Super Champion

First off, you don't need "bucket" when you are using timechart. You really only need "bucket" when you are using "chart" or "stats" and you need to do something fancy that you can't do with "timechart" out of the box; which is pretty rare.)

Looks like a "where" is all you are missing. Try this:

index="_internal" group="thruput" | timechart span=5m sum(instantaneous_eps) as ieps | where ieps < 5000

You can technically use a "where" clause directly in your timechart command, but you have to use a split-by clause for this to work. (I'm not 100% sure what the advantage is to doing this over simply using the where search command, but it's a viable option in any case.)

index="_internal" group="thruput" | timechart span=5m sum(instantaneous_eps) as ieps by host where ieps < 5000
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...