ai
Have pivt classify each result row against your instruction, adding ai_verdict, ai_confidence and ai_reasoning columns.
Use ai to classify your result rows with pivt, nano's AI assistant. Narrow the rows first, then provide an instruction to add a verdict, confidence, and reasoning to each row.
Use it to triage a short list of top talkers, rare processes, or summarized logon failures.
ai is slow and metered compared with ordinary commands. Reduce the result with filters, stats or head first.
Syntax
... | ai prompt="<instruction>" [max_rows=<n>]
... | ai "<instruction>"| Argument | Default | Description |
|---|---|---|
prompt | — (required) | The instruction. Name the verdict labels you want back, so a later where ai_verdict=... matches. A bare quoted string is the same as prompt=. |
max_rows | 100 | Rows sent to the model. Capped at 500. |
Output
Every row gets:
| Column | Type | Meaning |
|---|---|---|
ai_verdict | string | The label the model chose, from the ones your instruction implies (for example MALICIOUS, SUSPICIOUS, BENIGN) |
ai_confidence | number | 0.0 to 1.0 |
ai_reasoning | string | A short explanation |
Special verdicts:
SKIPPED: the row was pastmax_rows, or AI is not available on this deployment.ERROR: the AI call failed or timed out.ai_reasoningcarries the error.
Examples
Classify blocked proxy requests per source and destination:
metadata.log_source=conduit_proxy action_id=2 | stats count, sum(traffic.bytes_out) as sent by src_endpoint.ip, http_request.url.hostname | sort -count | head 50 | ai prompt="Classify each row as NORMAL, SUSPICIOUS or MALICIOUS. Look for data exfiltration, C2 beaconing and known-bad domains." | where ai_verdict!="NORMAL"Triage users with many failed logons:
class_uid=3002 status_id=2 | stats count, dc(src_endpoint.ip) as sources by user.name | where count > 20 | ai "Label each row BRUTE_FORCE, SPRAY or BENIGN based on failure count and number of source IPs." | sort -ai_confidenceReview rare PowerShell command lines:
class_uid=1007 process.name="powershell.exe" | rare limit=25 process.cmd_line | ai prompt="Is this command line likely malicious? Answer MALICIOUS or BENIGN." max_rows=25 | table process.cmd_line, ai_verdict, ai_confidence, ai_reasoningAvailability
Run commands after enrichment
ai runs after ClickHouse returns rows. The search splits at the first lookup, prevalence, inputlookup, resolve_identity, ai or lateral stage, and every command after it runs in post-processing. Only these commands work there: where, head, tail, sort, table, stats, dedup, rename, fields, top, rare, fillnull, eval, timechart, rex, risk, reverse, tree.
ai inside a subsearch (append, join, IN [ ... ]) is refused.
What's next
Search best practices
Write nPL searches that return quickly and correctly: time range first, field filters over keywords, narrow by log source and class, nano-side stages last.
anomaly
Find statistical outliers with z-score or MAD: unusual numeric values, unusual per-group totals, or values that occur unusually often.