Splunk Search

How to create a bucket of number of events instead of time?

msyparker
Explorer

Hello! 🙂

I'm tryng to get statistics of groups of 200 events.

For instance, I have the following stats:

|stats sum(CPU) avg(resptime) c as "total"

sum(CPU)----------avg(resptime)----------total
1000-----------------0.00240------------------800

What I wanted to have is:

sum(CPU)----------avg(resptime)----------total
120-------------------0.00125------------------200
300-------------------0.00124------------------200
480-------------------0.00122------------------200
100-------------------0.00122------------------200

OBS. I know how to create bins of time span, but what I need is to make buckets based on event quantity and NOT time.

Thank you in advance!

0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

... | streamstats count AS _serial
| eval _bucketOf200 = floor((_serial - 1)/ 200)
| stats sum(CPU) avg(resptime) count AS total BY _bucketOf200

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

... | streamstats count AS _serial
| eval _bucketOf200 = floor((_serial - 1)/ 200)
| stats sum(CPU) avg(resptime) count AS total BY _bucketOf200
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...