Search Commands
sample
sample
Return a random sample of events. Useful for testing and data exploration.
Description
The sample command randomly selects N events from your results. This is useful for getting a representative sample of large datasets, testing queries, or exploring data patterns.
Syntax
... | sample [<count>]Optional Arguments
count
Syntax: <int>
Description: Number of events to sample
Default: 1000
Examples
Sample 100 events
* | sample 100Default sample (1000)
* | sampleSample for testing
status=500 | sample 50 | table timestamp, url, error_messageSample before aggregation
* | sample 10000
| stats count() by src_ipQuick data exploration
source_type="firewall" | sample 10Representative sample
* | sample 5000
| top userUsage Notes
Random selection: Events are randomly selected, not the first N.
Performance: More efficient than processing all events for exploration.
Reproducibility: Results may vary between runs.
vs. head: sample is random, head returns first N events.