Search and filter Observability logs using ES|QL. Use when investigating log spikes, errors, or anomalies; getting volume and trends; or drilling into services or containers during incidents.
Detected risks:
A guided workflow for searching and filtering Observability logs with ES|QL during incident investigation. It is built for moments when you are chasing log spikes, errors, or anomalies, gauging volume and trends, or drilling into a specific service or container while an incident unfolds. It is explicitly scoped to logs - metrics and traces are handed off to their dedicated tools - and it insists on ES|QL via POST /_query rather than Query DSL.
The central idea is a funnel that mirrors Kibana Discover. Start broad with just a scope filter such as a service name and a time range, then iteratively add NOT exclusion clauses for the dominant noise patterns, always keeping the full accumulated filter, until fewer than twenty distinct log patterns remain - the point at which the surviving set is small enough to read as the actual errors or root cause. Stopping early, the skill warns, means reporting noise instead of failures. It standardizes parameter names (start, end, kqlFilter, limit, groupBy), tells you to filter on ECS field names, and stresses context minimization: KEEP only a handful of fields per sample and cap sample sizes so a step stays around a thousand tokens rather than thousands.
To drive each round it recommends a single five-way FORK query returning a trend histogram, a total count, sample logs, common message patterns, and rare message patterns in one request, and explains how to map and read those fork results to decide the next exclusion. The KQL guidance is notably candid about pitfalls - phrase queries and wildcards are preferred, while filtering on log.level or blindly searching for the word error is called out as often flawed because level metadata is unreliable and error matches harmless text. It also describes pivoting to an isolated entity or viewing logs in context when the funnel alone does not reveal the cause.
ES|QL only, issued through POST /_query. It explicitly instructs you not to use Query DSL.
For metrics or traces, which have their own dedicated tools. This skill is scoped to log search during incident investigation.
Start broad with a scope filter and time range, then iteratively add NOT exclusion clauses while keeping all previous ones, until fewer than twenty distinct log patterns remain and the surviving set reveals the root cause.
Because level metadata is often missing or wrong and full-text searches for error match harmless mentions like no error or error code 0; it recommends scoping by service or entity and iterating on real message patterns instead.
Five result sets: a trend histogram (fork1), a total count (fork2), sample logs (fork3), common message patterns (fork4), and rare message patterns (fork5), which together guide the next exclusion.
Quick Setup:
.claude/skills/Repository
elastic/agent-skills