Generate label matchers, line filters, log aggregations, and metric queries in LogQL (Loki Query Language) following current standards and conventions. Use this skill when creating new LogQL queries, implementing log analysis dashboards, alerting rules, or troubleshooting with Loki.
Overall
score
93%
Does it follow best practices?
Validation for skill structure
| Function | Description |
|---|---|
rate(log-range) | Entries per second |
count_over_time(log-range) | Count entries |
bytes_rate(log-range) | Bytes per second |
absent_over_time(log-range) | Returns 1 if no logs |
| Function | Description |
|---|---|
sum_over_time, avg_over_time, max_over_time, min_over_time | Aggregate numeric values |
quantile_over_time(φ, range) | φ-quantile (0 ≤ φ ≤ 1) |
first_over_time, last_over_time | First/last value |
sum, avg, min, max, count, stddev, topk, bottomk, approx_topk, sort, sort_desc
With grouping: sum by (label1, label2) or sum without (label1)
| Function | Description |
|---|---|
duration_seconds(label) | Convert duration string |
bytes(label) | Convert byte string (KB, MB) |
label_replace(rate({job="api"} |= "err" [1m]), "foo", "$1", "service", "(.*):.*")| logfmt [--strict] [--keep-empty]--strict: Error on malformed entries--keep-empty: Keep standalone keys| json # All fields
| json method="request.method", status="response.status" # Specific fields
| json servers[0], headers="request.headers[\"User-Agent\"]" # Nested/arrayCommon functions for line_format and label_format:
String: trim, upper, lower, replace, trunc, substr, printf, contains, hasPrefix
Math: add, sub, mul, div, addf, subf, floor, ceil, round
Date: date, now, unixEpoch, toDate, duration_seconds
Regex: regexReplaceAll, count
Other: fromJson, default, int, float64, __line__, __timestamp__
See assets/common_queries.logql for detailed usage examples.
Install with Tessl CLI
npx tessl i pantheon-ai/logql-generator@0.1.4