bin_size

Description

Returns the size of the time bin that’s being aggregated.

Typically used with time binning verbs timechart or align. When used with statsby returns the query window size.

Return type

duration

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

bin_size()

Examples

timechart 10m, bin_size: bin_size(), group_by()

Create a column named “bin_size” that contains the size of the bin that timechart is aggregating upon. In this case, it should always be 10 minutes.

timechart 5m, frame(back: 20m), bin_size: bin_size(), group_by()

Create a column named “bin_size” that contains the size of the bin that timechart is aggregating upon. In this case, it should always be 20 minutes.

timechart events_per_minute: count() / to_minutes(bin_size()), group_by()

Create a column named “events_per_minute” that shows the average number of events per minute.

statsby events_per_minute: count() / to_minutes(bin_size()), group_by()

Return a dataset with column “events_per_minute” that calculates the number of rows per minute over the entire query window.