Practice: event queries
12 min · 2 ejercicio(s)
Cheat sheet
| Syntax | Meaning |
|---|---|
process where … |
Only events with event.category = process |
any where … |
Any category |
==, != |
Case-sensitive comparison |
: |
Case-insensitive, supports * and ? wildcards |
in ("a", "b") |
One of several values (case-sensitive), in~ ignores case |
and, or, not |
Boolean logic |
cidrMatch(ip, "10.0.0.0/8") |
IP in network |
length(s), startsWith(s, "x"), endsWith |
String functions |
| head 5, | tail 5 |
Pipes that limit results |
== or :?
Process names are a classic trap: Windows shows PowerShell.exe, powershell.EXE or POWERSHELL.EXE depending on how it was started. Detections should use process.name : "powershell.exe" (case-insensitive). Use == when you need exact matching, for example on hashes or IDs.
Arrays
ECS fields like process.args are arrays. process.args == "cl" is true if any element equals cl. That is perfect to find a flag regardless of its position in the command line.