sort

This command is experimental

Definition

sort sorts defines how the results are sorted out.

Available sorting options are:

Examples

You can sort the dataset by using sort with the name of table column you want to sort.

%dpl
index=example | sort _raw
the simpliest sort example

Sorting Order

The default sorting order is ascending. You can use desc to change the sorting order to descending.

%dpl
index=example | sort _raw desc
descending example

You can also use + or - with table column names to define the sorting order.

Use + for ascending order.

%dpl
index=example | sort + _raw desc

Use - for descending order.

%dpl
index=example | sort - _raw desc

Sorting Options

auto

auto sorting option automatically sorts the results.

%dpl
index=example | sort auto(_raw)

Currently, auto doesn’t work in Teragrep. This will be fixed before the community release.

ip

ip sorting option interprets selected values as IP addresses.

%dpl
index=example | sort ip(_raw)

Currently, ip doesn’t work in Teragrep. This will be fixed before the community release.

num

num sorting option interprets selected values as numbers.

%dpl
index=example | sort num(_raw)

Currently, num doesn’t work in Teragrep. This will be fixed before the community release.

str

str sorting option interprets selected values as strings and orders them alphabetically.

%dpl
index=example | sort str(_raw)

Currently, str doesn’t work in Teragrep. This will be fixed before the community release.

Count

You can limit the amount of results by adding limit or a plain integer before the table column’s name.

If the count isn’t specified, sort will show 10 000 results by default.

%dpl
index=example | sort 7 _raw
%dpl
index=example | sort limit=7 _raw

Currently, limit works only when there’s a space between the argument and value. This will be fixed before the community release.