selectLast( ) Query Function

Specify a set of fields to select from events; for each field it will keep the field value of the most recent event with that field. This can be used to collect field values across a range of events, where each event contributes one or more fields to the output event. It is usually most useful in combination with groupBy.

Parameters

Name Type Required Default Description
fields [string] Yes The names of the fields to keep.

fields is the unnamed parameter.

Examples

Given event data like {id:a, from:x}, {id:a, to:x}, … emit a table with {id, from, to} tuples.

groupby(id, function=selectLast([from,to]))