top
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>]| Option | Default | Description |
|---|---|---|
N or limit=N | 10 | Number of rows to return. Can also follow the field: top user.name limit=5. |
field | The field to count. Only one field is used; if you list several, only the first counts. | |
by | Count field per combination with these fields. | |
showcount | true | Include the count column. |
showperc | true | Include 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
byfields),count, andpercent(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_methodreturns the five most common method and status pairs.
Examples
The ten most common processes on endpoints:
class_uid=1007 | top process.nameTop five users with failed logons:
class_uid=3002 status_id=2 | top 5 user.nameMost requested web hosts, ignoring events with no hostname:
class_uid=4002 http_request.url.hostname=* | top limit=20 http_request.url.hostnameMost common destination ports for outbound connections:
class_uid=4001 | top dst_endpoint.portMost common status code per HTTP method:
class_uid=4002 | top 10 http_response.code by http_request.http_methodBusiest AWS API operations:
top 10 api.operationNotes
- To see the least common values, use rare.
top fgives the same counts asstats count by f | sort -count | head 10, plus the percentage.topruns after alookup,prevalence,inputlookup,resolve_identity, oraistage too.