What is EQL?
10 min · 2 ejercicio(s)
EQL (Event Query Language) is a query language built for security analytics. It was created at Endgame to describe attacker behaviour, and has been part of Elasticsearch since Elastic acquired Endgame in 2019. Where KQL asks "which documents match?", EQL asks "which events, and which chains of events, match?"
process where process.name == "whoami.exe"That's a complete EQL query: an event category (process), the keyword where and a condition.
What makes EQL special
- Events, not documents. Every query names the kind of event it wants:
process,network,file,authentication, … EQL reads it from the ECS fieldevent.category. - Time order. Results are always sorted by
@timestamp. EQL thinks in timelines. - Sequences. The killer feature: describe several steps that must happen in this order, optionally on the same host or user and within a time window:
sequence by host.name with maxspan=5m
[process where process.name == "WINWORD.EXE"]
[process where process.parent.name == "WINWORD.EXE" and process.name == "powershell.exe"]"Word starts, and within five minutes on the same host Word starts PowerShell." That's a phishing macro. KQL and ES|QL can't express this in one query.
- Process lineage. With
process.parent.*andprocess.entity_idyou follow process trees.
Where you use EQL
| Place | What you do there |
|---|---|
| Elastic Security, EQL rules | Detection rules for multi-step attacks. Many prebuilt rules are EQL |
| Timeline → Correlation tab | Hunt for sequences interactively |
GET index/_eql/search API |
Run EQL from scripts |
EQL compared
| KQL | ES|QL | EQL | |
|---|---|---|---|
| Filter events | ✔ | ✔ | ✔ |
| Count, group, calculate | ✔ | (only simple pipes) | |
| Chronological order by default | ✔ | ||
| Sequences of events | ✔ | ||
| Typical user | Every Kibana user | Analysts, hunters | Detection engineers |
Requirements
EQL needs a timestamp field (@timestamp) and an event category field (event.category). Data that follows ECS has both. All lab indices do, so in this track you mostly query lab-endpoint with its process, network and file events.
🔎 Profundiza: funciones, errores habituales y práctica
Three kinds of EQL queries
| Query | Returns | Example |
|---|---|---|
| Event query | Single events | process where process.name == "whoami.exe" |
| Sequence | Ordered chains of events | sequence by host.name [file where …] [process where …] |
| Sample | Groups of events that share values, in any order | sample by host.name [process where …] [network where …] |
Pipes such as | head 10 and | tail 5 limit the result. EQL is deliberately small: no aggregations, no joins across indices. For counting and statistics you switch to ES|QL.
Case sensitivity
== compares exactly (case sensitive), : compares case insensitively and supports wildcards. Detection rules usually use : for process names, because Windows file names are case insensitive (PowerShell.exe and powershell.exe are the same program).
Why sequences matter for detection
A single event is rarely proof of an attack: powershell.exe runs on every IT workstation. The combination with context makes it suspicious: PowerShell started by Word, followed by a network connection to a rare IP. EQL sequences let a rule express exactly that, which cuts false positives dramatically.