Retrieves the oldest events first and returns a specified
maximum number of events. The head()
function sorts events by either @timestamp
or @ingesttimestamp, depending on the
selected query parameters. This function is equivalent to the
command-line head tool.
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
limit [a] | number | optional[b] | The argument given to this parameter determines the limit on the number of events included in the result of the function. The default argument is default . The maximum is controlled by the StateRowLimit dynamic configuration, which is StateRowLimit by default. If the argument is max (limit=max ), then the value of StateRowLimit is used. | |
Minimum | 0 | |||
Maximum | 20,000 | The default maximum limit is not static and can be changed by setting
the StateRowLimit
dynamic configuration. | ||
[b] Optional parameters use their default value unless explicitly set. |
The maximum value of the limit
parameter
can be adjusted using the
StateRowLimit
dynamic configuration.
Note
The head()
function is often used with
Sequence Query Functions, as these functions must
be used after an aggregator function to ensure event ordering.
head()
Syntax Examples
Select the 10 oldest with
loglevel=ERROR
logscaleloglevel=ERROR | head(10)
Select the 100 oldest events and group them by
loglevel
logscalehead(limit=100) | groupBy(loglevel)
head()
Examples
Click
next to an example below to get the full details.Calculate Running Average of Field Values
Calculate a running average of values in a dataset using the accumulate()
function