Correlating across sources
12 min · 2 ejercicio(s)
The real payoff of ECS comes during an investigation. You have one indicator, for example the C2 address 45.133.1.20, and you want to know every place it appears:
FROM lab-* METADATA _index
| WHERE destination.ip == "45.133.1.20" OR source.ip == "45.133.1.20"
| STATS events = COUNT(*), first_seen = MIN(@timestamp), last_seen = MAX(@timestamp) BY _indexFROM lab-* reads all lab indices. Fields that don't exist in an index are simply null there. Because every index calls the address destination.ip and maps it as ip, the condition works everywhere.
What ECS can't find
Run the query and look closely: the firewall log in lab-raw also saw every connection to 45.133.1.20, but the address is still hidden inside message. Unmapped data is invisible to field-based queries, dashboards and rules. That's why mapping new sources to ECS is part of every detection engineering job.
Pivoting
A good investigation pivots from one field to the next:
- IP
45.133.1.20→host.nameof the machines that talked to it. host.name→user.namelogged on to these hosts.user.name→ everyprocess.namethat user started.
Each step uses the same field names in every index, so each step is one short query.
Also in KQL
In Kibana, a data view over several indices (lab-*) plus a KQL query like user.name: m.keller gives you the same cross-source view in Discover. The data view is the "FROM", KQL the filter.
🔎 Profundiza: funciones, errores habituales y práctica
Type conflicts
If one index maps source.ip as ip and another as keyword, Kibana shows a field conflict and ES|QL reports an unsupported or union type. Queries across both silently miss data or fail. Index templates that follow ECS (and ecs@mappings in recent Elasticsearch versions) prevent this.
Time zones
ECS stores @timestamp in UTC. Correlating across sources only works when every source was converted correctly at ingest. A syslog source parsed without a time zone can be off by hours, and suddenly the "first" event isn't first anymore.