Practice: parsing like a detection engineer
12 min · 2 ejercicio(s)
Cheat sheet
| Task | ES|QL |
|---|---|
| Typed capture | %{INT:bytes:int}, %{NUMBER:total:double} |
| Custom format | (?<order_id>ORD-\d{4}-\d{6}) |
| Optional words | (?:invalid user )? |
| One of several | (?<method>password|publickey) |
| Fixed delimiters | DISSECT message "%{a} %{b} %{c}" |
| Skip a part | %{} (DISSECT), unnamed %{DATA} (Grok) |
| Parse into ECS | %{IP:source.ip}, RENAME dst AS destination.ip |
From exploration to pipeline
- Find the line types with
STATS COUNT(*) BY event.datasetand a look atmessage. - Build the pattern in ES|QL step by step, check for
nullrows. - Name the captures after ECS fields and add types.
- Copy the pattern into a
grokprocessor (escape backslashes for JSON), test with_simulate. - Attach the pipeline and keep the original line in
message.