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
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...