Skip to content

sort

Sorts events by the given expressions.

sort [-]expr...

Sorts events by the given expressions, putting all null values at the end.

If multiple expressions are specified, the sorting happens lexicographically, that is: Later expressions are only considered if all previous expressions evaluate to equal values.

This operator performs a stable sort (preserves relative ordering when all expressions evaluate to the same value).

An expression that is evaluated for each event. Normally, events are sorted in ascending order. If the expression starts with -, descending order is used instead. In both cases, null is put last.

sort timestamp
sort -timestamp

Sort by a field src_ip and, in case of matching values, sort by dest_ip:

sort src_ip, dest_ip

Sort by the field src_ip in ascending order and by the field dest_ip in descending order.

sort src_ip, -dest_ip

reverse