Iniciar sesión

Practice: from raw log to ECS

12 min · 2 ejercicio(s)

Cheat sheet

Step ES|QL Ingest pipeline
Fixed format DISSECT message "…" dissect processor
Variable format GROK message "…" grok processor
key=value DISSECT with every key kv processor
Rename to ECS RENAME src AS source.ip rename processor
Fix types TO_IP(), TO_INTEGER() convert processor
Categorize EVAL event.category = "network" set processor

The firewall log, mapped

Firewall key ECS field
SRC source.ip
DST destination.ip
SPT, DPT source.port, destination.port
PROTO network.transport (lowercase: tcp)
[FW-ALLOW], [FW-BLOCK] event.type: allowed / denied, event.action
IN, OUT observer.ingress.interface.name, observer.egress.interface.name

The firewall itself is the observer: ECS uses observer.* for devices that see traffic without being one of its ends.

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. The firewall, straight into ECS

    Write a DISSECT pattern for the firewall that writes directly into ECS fields: the source and destination address, the destination port and the verdict (ALLOW/BLOCK, into event.action). Skip everything else with %{}.

    Mar 12 09:58:20 fw-edge-01 kernel: [FW-ALLOW] IN=lan0 OUT=wan0 SRC=10.10.6.61 DST=45.133.1.20 LEN=60 PROTO=TCP SPT=49712 DPT=443
  2. 2. The observer

    The firewall is neither source nor destination: it observes the traffic. The lab parsed the blocked lines into in (the receiving interface, wan0) and src. Map them to ECS and categorize the lines:

    • in → the observer's ingress interface name
    • src → the address the packet came from
    • event.category and event.type for a blocked connection