Deployment Architecture

Why does the bucket command show 3 rows when bin=4, but 1 row when bin=3?

pramit46
Contributor

when I use the following:

index= _internal  | bucket size bins=3 |stats count(_raw) by size

I see:
size-----------count(_raw)
0-100000000-------------7

But if use:

index= _internal  | bucket size bins=4 |stats count(_raw) by size

I see:
size---------------count(_raw)
0-10000000--------------4
20000000-30000000---2
30000000-40000000---1

Should it not also show 3 rows when bin number was set to 3?

Tags (3)
0 Karma
1 Solution

stephanefotso
Motivator

Hello! Bucket/bins does not means number of rows, but it means number of rows if possible. When you say: index= _internal | bucket size bins=3 |stats count(_raw) by size it just means: Bucket search results into 3bins, and return the count of raw events for each bucket. Depending of your time range,and the number of events, you could get 0,1, 2, or 3 rows max, not 4.

Thanks

SGF

View solution in original post

stephanefotso
Motivator

Hello! Bucket/bins does not means number of rows, but it means number of rows if possible. When you say: index= _internal | bucket size bins=3 |stats count(_raw) by size it just means: Bucket search results into 3bins, and return the count of raw events for each bucket. Depending of your time range,and the number of events, you could get 0,1, 2, or 3 rows max, not 4.

Thanks

SGF

pramit46
Contributor

Thanks for the clarification @stephanefotso
One small confusion, does it mean that it may or may not put the data in all the buckets? I mean will it always put the data in 3 bins or only 1 bin sometimes?

0 Karma

stephanefotso
Motivator

Here is the description of bucket according to the manual:

Puts continuous numerical values in fields into discrete sets, or buckets, by adjusting the value of field so that all items in a particular set have the same value.

It just means that, it may put the data in all the buckets if values of data returned by the search, allow him to do so. If not, it will return less than the number of buckets you have precised.
Thanks

SGF

pramit46
Contributor

🙂
"so that all items in a particular set have the same value." this clears everything..
Thanks

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...