CQL examples and saved queries

The seven built-in saved queries, plus short patterns to adapt.

Verified against v1.0.0-rc.1 · sources

On this page

The built-in saved queries are listed by GET /api/v1/saved-queries.

Built-in saved queries#

Errors by service

cql
level IN (error,fatal) | stats count() by service | sort -count

Failed logins

cql
log_type=auth auth_result=failure | stats count() by user_tok, host | sort -count | limit 50

Top slow endpoints

cql
log_type=nginx | stats p95(duration_ms), count() by http_path | sort -p95_duration_ms | limit 20

5xx rate

cql
log_type=nginx | timechart span=1m count() by http_status

PII masked count

cql
source=masking | stats sum(n) by rule

k8s restarts and OOM

cql
log_type=k8s (OOMKilled OR "Back-off restarting") | stats count() by k8s_ns, service

Gaps, last 24 h

cql
source=gaps

Patterns#

Count errors in a window and keep the top five services:

cql
level=error | top 5 service

Count only slow requests next to all requests:

cql
log_type=nginx | stats count() as total, count_if(duration_ms>1000) as slow by http_path

Find a field that only some events carry:

cql
order_id:exists level=error | fields ts, service, msg

Sources

This page was checked against: crates/cql/src/lib.rs, crates/api/src/lib.rs.

Report an inaccuracy (opens a new issue in the Drillo repository; nothing is sent from this page)