Iniciar sesión

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 _index

FROM 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:

  1. IP 45.133.1.20 → host.name of the machines that talked to it.
  2. host.name → user.name logged on to these hosts.
  3. user.name → every process.name that 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.

Ejercicios prácticos de esta lección

Resuelve estos ejercicios con una consulta en el laboratorio Elasticsearch real. Inicia sesión gratis para acceder al laboratorio, las pistas y la corrección automática.

  1. 1. Make the shop log correlate

    The shop's database errors name the client:

    2026-03-13T21:07:02.512Z ERROR [db] query failed: You have an error in your SQL syntax near '' (path=/products client=203.0.113.66)

    lab-web stores the same address in an ECS field. Rename the parsed field client so a single query on that field finds the attacker in both sources.

  2. 2. The full command

    To pivot from the C2 address to what the attacker ran, you need the complete command of a process, including all arguments (powershell.exe -nop -w hidden -enc …). Which ECS field holds it?