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 Features.

Evaluates the function argument on all values in the array under the array argument overwriting the array. If an as argument has been supplied array:eval will save the result in an array under the supplied prefix. Notice that this overwrites existing arrays of that name.

ParameterTypeRequiredDefaultDescription
arraystringtrue The prefix of the array in Humio, for example for events with fields incidents[0], incidents[1], ... this would be incidents. [a]
asstringfalse The name of the output array. Default is to use the same as the input array.
functionstringtrue The function to be applied to each element of the array.
varstringtrue The name of the variable to be used in the corresponding function.

[a] When you provide only one parameter, the implied parameter is array

Examples

To square the value of each item in the array:

humio
values = [2,3,4]

Use the following query function:

humio
array:eval(values, as=squared, var="x", function={x := x*x})

The expected output:

humio
squared = [4, 9, 16]