nano SIEM
Search Commands

tail

Supported in:Self-hosted

Keep the last N rows of a sorted result, or the newest N events in time order.

Use tail to keep the last N rows of an ordered result. On raw events, it returns the newest N events in ascending time order.

Syntax

... | tail [<count>]
ArgumentDefaultDescription
count10Number of rows to keep.

How it works

  • On raw events, tail keeps the newest N events and shows them in ascending time order (oldest of the N first). That reads like the end of a log file.
  • After sort time, tail N is the same thing: the N newest events, oldest first. It is not the oldest events; for those use sort time | head N.
  • After sort on another field, or after stats, tail keeps the last N rows of that order. Since stats orders by count descending, stats count by f | tail 10 gives the ten smallest groups.

Examples

The last ten events from a source, in reading order:

metadata.log_source=windows_event | tail

The 50 most recent process launches, oldest of them first:

class_uid=1007 | sort time | tail 50 | table time, device.hostname, process.cmd_line

The ten least common processes by host count:

class_uid=1007 | stats dc(device.hostname) as hosts by process.name | sort -hosts | tail 10

Notes

  • tail also runs after a nano-side stage (lookup, prevalence, inputlookup, resolve_identity, ai, lateral).
  • For rare values with counts and percentages in one step, use rare.

What's next

  • head: the first N rows
  • sort: set the order first
  • reverse: flip the order
  • rare: least common values

On this page