sample
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>]| Argument | Default | Description |
|---|---|---|
count | 1000 | Number of rows to pick. |
How it works
samplepicks 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
sortaftersampleif 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.codeEstimate the mix of log sources from a random slice:
* | sample 1000 | stats count by metadata.log_sourceA random set of process launches to review:
class_uid=1007 | sample 50 | sort time | table time, device.hostname, actor.user.name, process.cmd_lineNotes
- A sample is not a count. Use
stats counton the full result for exact numbers.