objectArray:eval() function iterates over the values of a nested array, applies the function on each element, and returns results in a new array field. Currently, the function supports only flat arrays as the output.

Although objectArray:eval() can be used on both flat arrays and nested arrays, then for best performance, we recommend using objectArray:eval() only for nested arrays (for example JSON structures). For flat arrays, the array:eval() function is a recommended equivalent. For a list of functions that can be used on flat arrays, see Array Query Functions.

ParameterTypeRequiredDefault ValueDescription
array[a]stringrequired   The array name in LogScale Array Syntax, for example, for events with fields incidents[0], incidents[1], ... this would be incidents[], as in objectArray:eval(array="incidents[]", ....
asArraystringrequired value passed to the array parameter The output array — cannot be the same as the input array.
functionnon-aggregate functionrequired   The function applied to each element of the array. This argument is used to write a value to the same field that is given as the output array in the asArray argument. In objectArray:eval() Examples, such a field is _mapped.
varstringoptional[b] input array name Name of the variable to use in the function argument.

[a] The parameter name array can be omitted.

[b] Optional parameters use their default value unless explicitly set.

Hide omitted argument names for this function

Show omitted argument names for this function

When using this function:

  • The variable defined by the var argument is validated to ensure it does not contain object/array access patterns, for example, [..] or ..

  • The variable becomes available as a "pseudo-field" (meaning that it's not like a proper field in the event) in the function argument (see objectArray:eval() Examples).

  • The "pseudo-field" can access structured data on the array entries using an array access pattern consisting of [number] for array indexing and . for sub-selections of object fields. These can be repeated/combined arbitrarily; for example, x.foo[0].bar.baz is a valid pattern.

  • The mapping between input and output array entries is done by the function argument: for each input array entry, function maps an output array entry. The output/result value of function is the value of the same field (without []) given by the asArray argument.

Click + next to an example below to get the full details.

Concatenate Values From Two Nested Array Elements

Concatenate values from two nested array elements returning output in flat array

Format Values From Two Array Elements Using :

Format Values from Two Array Elements using : as a separator

Concatenate Multiple Values From Nested Array Elements

Concatenate multiple values from nested array elements using objectArray:eval() function with concat()

Concatenate Values From Nested Array Elements

Concatenate deeply nested objects and arrays using objectArray:eval() function with concat()

Concatenate Values From Deeply Nested Array Elements

Concatenate deeply nested objects and arrays using objectArray:eval() function with itself

Concatenate Object Arrays Into Single Array

Concatenate one or more objects from object arrays into a single array and string