Practice: fields, values and phrases
12 min · 2 exercice(s)
This chapter wraps up the module. Use the cheat sheet, then solve the extra exercises without hints first.
Cheat sheet
| You want | KQL | Note |
|---|---|---|
| Exact value in a field | user.name: m.keller |
Keyword fields match the whole value |
| Value with spaces | event.reason: "bad password" |
Quotes make it a phrase |
| One of several values | service.name: (ssh or rdp) |
Shorter than repeating the field |
| Any field contains a value | 185.220.101.47 |
Free text: slow and imprecise, avoid in rules |
How Kibana reads your query
- Kibana parses the KQL text into a tree of conditions.
- Every
field: valuebecomes a match (text fields) or term (keyword, ip, number) query. - The result is a filter: documents either match or they don't. There is no ranking in KQL.
Typical mistakes
- Wrong case on keyword fields.
service.name: SSHfinds nothing when the data saysssh. Keyword matching is case-sensitive unless the field has a normalizer. - Forgetting quotes.
event.reason: bad passwordis read asevent.reason: bador the free-text termpassword. - Typos in field names. KQL does not warn you about unknown fields, it just returns 0 hits. Check the field list in the sidebar.
Work like an analyst
Start broad and narrow down. First host.name: srv-web-01 to see what normal looks like, then add one condition at a time and watch how the hit count changes.