Field sets and naming rules
14 min · 2 ejercicio(s)
ECS has more than 40 field sets. For security data you need these all the time:
| Field set | Describes | Examples |
|---|---|---|
event.* |
What happened, categorization | event.category, event.outcome, event.dataset |
host.* |
The machine the event happened on | host.name, host.ip, host.os.family |
user.* |
The user | user.name, user.domain |
source.*, destination.* |
The two ends of a network connection | source.ip, destination.port, destination.geo.country_iso_code |
client.*, server.* |
The same, from the application's point of view | client.ip |
process.* |
A running program, its parent and arguments | process.name, process.command_line, process.parent.name |
file.* |
A file | file.path, file.extension |
network.* |
Connection details | network.transport, network.direction |
url.*, http.*, user_agent.* |
Web requests | url.path, http.response.status_code |
threat.* |
Threat intelligence and MITRE ATT&CK | threat.indicator.ip, threat.technique.id |
Reusing field sets
Some field sets appear inside others. geo.* exists under source, destination, client and host: source.geo.country_iso_code. process.parent reuses the whole process set: process.parent.name, process.parent.pid. Once you know a set, you know it everywhere.
Naming rules
- All lowercase, words separated by
_:country_iso_code, notcountryIsoCode. - Nesting with dots, from general to specific:
http.response.status_code. - Singular for single values, plural only for fields that hold several (
host.ipis an array of all addresses but stays singular by convention,related.hostsis plural). - Same type everywhere: every
*.ipisip, every*.portislong,*.bytesislong.
source vs. destination
source is who initiated the connection, destination who received it. For outgoing traffic from a workstation, the workstation is the source. For a web shop, the visitor is the source and the shop is the destination.
🔎 Profundiza: funciones, errores habituales y práctica
keyword and text
ECS maps most string fields as keyword: exact, case-sensitive, good for filtering and aggregations. Fields people search for words in get an additional .text multi-field of type text, e.g. process.command_line.text or user_agent.original.text. That's why in the KQL track process.command_line was matched with wildcards: it is a keyword.
Custom fields
ECS can't know your application. Put your own fields in a namespace that ECS won't use, ideally your organization or product name: kestrel.order.id, not order_id at the top level. Never reuse an ECS name with a different meaning or type, that breaks every query and rule that relies on it.
Arrays
event.category and event.type are arrays (["network"], ["connection", "start"]). KQL, EQL and ES|QL match if any value matches, so you rarely notice, but STATS … BY event.type counts a document once per value.