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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...