Iniciar sesión

Process lineage

14 min · 2 ejercicio(s)

To connect a process with what it did (network connections, files), join on the unique process identifier process.entity_id instead of the host. Different join fields per event are possible:

sequence with maxspan=5m
  [process where process.name == "powershell.exe"] by process.entity_id
  [network where true] by process.entity_id

Here the network event must come from the same process that was started in the first step.

To follow a parent/child relation, join the parent's process.entity_id with the child's process.parent.entity_id:

sequence with maxspan=1m
  [process where process.name == "WINWORD.EXE"] by process.entity_id
  [process where true] by process.parent.entity_id

process.pid is not a good join key: PIDs are reused by the operating system. ECS provides entity_id exactly for this purpose.

Pipes

EQL supports a few pipes after the query:

Pipe Meaning
` head 5`
` tail 5`

🔎 Profundiza: funciones, errores habituales y práctica

Process identity in ECS

Field Unique? Use
process.pid no, reused by the OS display only
process.entity_id yes, per process instance joins between events of one process
process.parent.entity_id yes parent ↔ child joins
process.group_leader.entity_id, process.session_leader.entity_id yes Linux session trees

Elastic Defend and Sysmon (ProcessGuid) provide these IDs. If your data source has no entity ID, join on host.name and process.pid within a short maxspan as a fallback.

Pipes

Pipe Example
head n the first n events or sequences
tail n the last n

Samples

For unordered correlations EQL also has sample by host.name [ … ] [ … ]: it finds events that share join keys regardless of order and time. Useful for "this host had both X and Y" questions.

Visualising lineage

In Elastic Security the Analyzer draws the process tree of an alert from entity_id relations. In the lab you reconstruct it with sequences: Outlook → Word → PowerShell → updater.exe / network / schtasks.

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. Where does the shell connect to?

    Join a powershell.exe process start with network events of the same process (process.entity_id). Which destination.ip does it contact?

  2. 2. Children of Word

    Use a parent/child sequence: which process.name did WINWORD.EXE start?