nano SIEM
Search Commands

sample

Supported in:Self-hosted

Pick N random events from the whole result instead of the newest ones.

Use sample to review a random set of N rows from your results rather than only the newest events.

Syntax

... | sample [<count>]
ArgumentDefaultDescription
count1000Number of rows to pick.

How it works

  • sample picks rows at random from everything the earlier stages return, across the whole time range. head picks the newest rows instead.
  • Each run picks a different set.
  • The picked rows don't come back in any particular order. Add sort after sample if order matters.

Examples

Inspect field coverage across the day with twenty random web requests:

class_uid=4002 | sample 20 | table time, metadata.log_source, http_request.url.url_string, http_response.code

Estimate the mix of log sources from a random slice:

* | sample 1000 | stats count by metadata.log_source

A random set of process launches to review:

class_uid=1007 | sample 50 | sort time | table time, device.hostname, actor.user.name, process.cmd_line

Notes

  • A sample is not a count. Use stats count on the full result for exact numbers.

What's next

  • head: the newest N rows
  • dedup: one row per value

On this page