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!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco + Splunk! We’ve ...