nano SIEM
Search Commands

top

Supported in:Self-hosted

The most common values of a field, with a count and a percentage of all events.

Use top to find the most common values of a field in your search results. Each value includes a count and percentage.

Syntax

... | top [limit=<N> | <N>] <field> [by <field> ...] [showcount=<bool>] [showperc=<bool>]
OptionDefaultDescription
N or limit=N10Number of rows to return. Can also follow the field: top user.name limit=5.
fieldThe field to count. Only one field is used; if you list several, only the first counts.
byCount field per combination with these fields.
showcounttrueInclude the count column.
showperctrueInclude the percent column.

You can start a query with top and no pipe: top 5 process.name.

How it works

  • Output columns: the field (and any by fields), count, and percent (share of all events, two decimals).
  • Rows are ordered by count, highest first.
  • Events where the field is null are counted as their own value. Add field=* to the search to leave them out.
  • With by, the limit applies to the combinations overall, not per group: top 5 http_response.code by http_request.http_method returns the five most common method and status pairs.

Examples

The ten most common processes on endpoints:

class_uid=1007 | top process.name

Top five users with failed logons:

class_uid=3002 status_id=2 | top 5 user.name

Most requested web hosts, ignoring events with no hostname:

class_uid=4002 http_request.url.hostname=* | top limit=20 http_request.url.hostname

Most common destination ports for outbound connections:

class_uid=4001 | top dst_endpoint.port

Most common status code per HTTP method:

class_uid=4002 | top 10 http_response.code by http_request.http_method

Busiest AWS API operations:

top 10 api.operation

Notes

  • To see the least common values, use rare.
  • top f gives the same counts as stats count by f | sort -count | head 10, plus the percentage.
  • top runs after a lookup, prevalence, inputlookup, resolve_identity, or ai stage too.

What's next

  • rare: least common values
  • stats: any aggregation per group
  • head: keep the first N rows

On this page