Home / Search/ Language Reference/ Operators/ Display Operators/range

range

The range operator generates a series of events, each containing a generated numeric field and a _time field. You can use this operator as syntactic sugar on the $vt_dummy virtual table, to generate a defined range of events with equally spaced values.

This is a data-generating operator, not a data-consuming operator.

Syntax

    range <FieldName> from <Start> to <Stop> [step <Step>]

Arguments

NameTypeRequiredDescription
FieldNameStringYesThe name of the single column in the output table.
StartInt, Long, Real, Datetime, or TimespanYesThe smallest value to generate.
StopInt, Long, Real, Datetime, or TimespanYesThe highest value to generate; or, if Step would generate a value exceeding this parameter, a bound on the highest value.
StepInt, Long, Real, Datetime, or TimespanNoThe difference between two consecutive values in the output.

Results

A series of events, each containing a field called <FieldName>, whose values are: <Start>, <Start> + <Step>, … up to and including <Stop>.

Examples

Generate 10 equally spaced events, numbered 1 to 10:

range theField from 1 to 10

Generate five equally spaced events, numbered 1 to 9:

range theField from 1 to 10 step 2

Generate a series of hourly events, starting three days back:

range theField from ago(3d) to ago(2d) step 1h | project strftime(theField,'%Y-%m-%dT%H:%M:%S.%L%Z')

Generate a week’s worth of daily events:

range _time from ago(7d) to now() step 1d

Generate 10 event values from 10 to 100, incremented by 10:

range myField from 10 to 100 step 10