ES|QL language preview
1. Error rate by host
FROM/WHERE/STATS pipeline with COUNT
horizon-dark
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 atom-one-dark
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 github-dark
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 dracula
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 nord
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 github
FROM logs-*
| WHERE status >= 500
| STATS count = COUNT(*) BY host
| SORT count DESC
| LIMIT 10 2. EVAL and KEEP
computed columns and field pruning
horizon-dark
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 atom-one-dark
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 github-dark
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 dracula
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 nord
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 github
FROM metrics
| EVAL ratio = bytes_out / bytes_in
| KEEP host, ratio
| WHERE ratio > 2 3. GROK parse
comments and string patterns
horizon-dark
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path atom-one-dark
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path github-dark
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path dracula
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path nord
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path github
// extract request path
FROM logs
| GROK message "%{WORD:method} %{URIPATH:path}"
| STATS hits = COUNT(*) BY path