nano SIEM
Search Commands

Quick reference

Supported in:Self-hosted

Every nPL command, operator and aggregation on one page, with OCSF 1.9 examples.

Use this reference to choose an nPL command and adapt its syntax or example to your search. Fields use OCSF 1.9 paths; see Syntax for the grammar and Functions for function arguments.

Search expression

ConstructExample
Keyword / phrasemimikatz, "access denied"
Field compareuser.name=administrator, http_response.code>=500, dst_endpoint.port!=443
Wildcardprocess.name=*.ps1, *svchost*
Field present / absentuser.name=*, user.name!=*
Regexprocess.cmd_line=/-enc\s/, process.cmd_line =~ "-enc", !~
IN listclass_uid IN (3002, 3003), NOT IN (...)
CIDRsrc_endpoint.ip=10.0.0.0/8, dst_endpoint.ip IN CIDR("10.0.0.0/8", "192.168.0.0/16")
Word operatorsLIKE "%.exe", CONTAINS, STARTSWITH, ENDSWITH (each with NOT)
Indicatorioc=203.0.113.50, ioc in [a, b]
Subsearchdevice.hostname IN [search class_uid=3002 status_id=2 | return device.hostname]
BooleanAND / &&, OR / ||, NOT, ( )
Timeearliest=-24h latest=now
Comments// to end of line, /* block */

Precedence: in the search expression NOT > OR > AND (a b OR c = a AND (b OR c)); in where and eval NOT > AND > OR.

class_uid=3002 status_id=2 (user.name=administrator OR user.name=root) earliest=-24h // failed admin logons
dst_endpoint.ip IN CIDR("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16") dst_endpoint.port IN (445, 3389, 5985)

Commands

Filter and select

CommandSyntaxExample
searchsearch <expr>svchost | search NOT process.name=svchost.exe
wherewhere <expr>class_uid=4001 | where traffic.bytes_out > 10000000
regexregex [f=|f!=]"pat"class_uid=1007 | regex process.cmd_line="-enc\s"
dedup, uniqdedup f… [keepfirst=|keeplast=]class_uid=3002 | dedup user.name
headhead [N] (10)class_uid=3002 | head 20
tailtail [N] (10)class_uid=3002 | tail 5
samplesample [N] (1000)class_uid=4002 | sample 50

Aggregate

CommandSyntaxExample
statsstats agg… [by f…]class_uid=3002 | stats count, dc(user.name) by src_endpoint.ip
chartchart agg… [over f] [by f]class_uid=4002 | chart count over http_request.http_method by http_response.code
timecharttimechart [span=1h] agg… [by f]class_uid=3002 status_id=2 | timechart span=15m count
toptop [N] f [by f…]class_uid=4001 | top 10 dst_endpoint.port
rarerare [N] f [by f…]class_uid=1007 | rare process.name
eventstatseventstats agg… [by f…]class_uid=4001 | eventstats avg(traffic.bytes_out) as avg_out by src_endpoint.ip
streamstatsstreamstats [current=] [window=N] agg… [by f…]class_uid=3002 | streamstats count as n by user.name
bin, bucketbin f span=<dur|num>class_uid=4001 | bin time span=5m | stats count by time
anomalyanomaly field=f | agg(x) [by f] [threshold=3] [method=zscore|mad]class_uid=4001 | anomaly sum(traffic.bytes_out) by src_endpoint.ip

Shape fields

CommandSyntaxExample
evaleval f=expr[, …]class_uid=4001 | eval total=traffic.bytes_in + traffic.bytes_out
tabletable f [as a], …class_uid=3002 | table time, user.name, src_endpoint.ip
fieldsfields [+|-] f, …class_uid=1007 | fields - raw_data
renamerename f as n, …class_uid=3002 | rename src_endpoint.ip as client
rex, extractrex [field=f] "(?<name>…)", rex mode=sed field=f "s/a/b/g"class_uid=4002 | rex field=http_request.url.path "/api/(?<api>[^/]+)"
spathspath [input=f] [output=f] [path=p]see page
fillnullfillnull [value=v] f…class_uid=3002 | fillnull value="-" user.domain
mvexpandmvexpand f [limit=N]class_uid=4003 | mvexpand answers.rdata
sortsort [N] [-|+]f, …… | sort -count
reversereverseclass_uid=3002 | head 20 | reverse

Correlate

CommandSyntax
joinjoin [type=inner|left|outer] [max=N] f[, f] [ <subsearch> ]
appendappend [maxout=N] [ <subsearch> ]
transactiontransaction f… [startswith=…] [endswith=…] [maxspan=dur] [maxevents=N]
sequencesequence by f… [maxspan=dur] [cond1] [cond2] …
funnelfunnel by f… [window=dur] [step1] [step2] …
laterallateral [seed=auto|user|host] [entity=f] [maxhops=N] [window=dur] [methods=auth,network,process]
treetree process, tree web, tree parent=f child=f label=f
returnreturn [N] f, …
formatformat [maxresults=N]
class_uid=1007 | join device.hostname [search class_uid=3002 status_id=2 | stats count as failures by device.hostname | where failures > 50]
class_uid=3002 | sequence by user.name maxspan=10m [status_id=2] [status_id=1]

Enrich and investigate

CommandSyntax
lookuplookup <table> <col> [AS <event_field>] [OUTPUT|OUTPUTNEW c [AS r], …]
inputlookupinputlookup <table> (or url="…")
prevalenceprevalence enrich=true, prevalence hash_prevalence < 5, prevalence f[, f]
resolve_identity, resolve-identityresolve_identity [field=f] [max_age=dur]
riskrisk score=<0-100|expr> [entity=f] [factor=expr] [weight=0-1]
retroioc=<value> | retro [by asset|host|ip|entity|account|user|indicator]
aiai prompt="…" [max_rows=N]
assetasset [field=f]
baselinebaseline [host=|user=|ip="v"] [window=dur]
cloudcloud [by=provider|account|region|service|resource]

Observability

CommandSyntax
services| services
service| service <name>
trace| trace <trace_id>
metric| metric <name> [service=<svc>]

Legacy

output <name> is accepted for compatibility with older saved searches and does nothing.

Aggregations

Use in stats, chart, timechart, eventstats and streamstats. Name a result with as.

FunctionMeaning
count, count(f)Rows, or rows where f is set
dc(f) / distinct_count(f), estdc(f)Distinct values (exact / approximate)
sum, avg, min, max, rangeNumeric summaries
median, mode, stdev, varDistribution
percentile(f, N), p95, p99, perc95Percentiles
values(f), list(f)Distinct values / all values
first, last, earliest, latestValues by order or time
sparkline, rate, histogram_quantile(f, N)Trend and OpenTelemetry metric helpers

Conditional form: count(eval(status_id=2)). Expression arguments work: sum(traffic.bytes_in + traffic.bytes_out).

Nano-side stages

  • lookup, prevalence, inputlookup, resolve_identity, ai and lateral run after ClickHouse returns rows. After the first of them, only where, head, tail, sort, table, stats, dedup, rename, fields, top, rare, fillnull, eval, timechart, rex, risk, reverse, and tree work.
  • ai needs nano Self-run with an AI provider configured; on open core every row comes back SKIPPED. See pivt AI settings.

On this page