Important
This function is considered experimental and under active development and should not be used in production.
The function must be enabled using the feature flag ArrayFunctions. See Enabling & Disabling Feature Flags.
Computes an aggregate value for each array element with the same index.
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
array [a] | string | required | The prefix of the array in LogScale, for example, for events with fields incidents[0], incidents[1], ... this would be incidents . | |
as | string | optional[b] | _reduceColumn | Name of the output array. |
function | array of aggregate functions | required | Aggregate function to use (for example, max() ). If several aggregators are listed for the function parameter, then their outputs are combined using the rules described for stats() . | |
var | string | required | Placeholder field name to use for array elements in the aggregate function. | |
[b] Optional parameters use their default value unless explicitly set. |
If, for example, all events contain arrays with the time taken for 3 different tasks, the query
array:reduceColumn(times, var=x,function=[avg(x), max(x)])
will compute the maximum and average time for each task.
If function
is an
aggregator that produces more than one event, such as
groupBy()
, the output of
array:reduceColumn()
will contain the same number of
events as the maximum number of events produced in a column. The nth event
will contain an array with the values from the nth event in all columns
having an nth event. This can lead to unreliable ordering of the output if
the internal aggregate does not output ordered events (such as
groupBy()
).
array:reduceColumn()
Examples
Click
next to an example below to get the full details.Compute Aggregate Value for Each Array Element With Same Index
Compute an aggregate value for each array element with the same index using the array:reduceColumn()
Compute Average Value for Each Array Element With Same Index
Compute an average value for each array element with the same index across multiple events using the array:reduceColumn()