CtrlK
BlogDocsLog inGet started
Tessl Logo

pantheon-ai/logql-generator

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

Overview
Skills
Evals
Files

function_reference.mdreferences/

LogQL Function and Parser Reference

Quick Function Reference

Log Range Aggregations (most common)

FunctionDescription
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

Unwrapped Range Aggregations (most common)

FunctionDescription
sum_over_time, avg_over_time, max_over_time, min_over_timeAggregate numeric values
quantile_over_time(φ, range)φ-quantile (0 ≤ φ ≤ 1)
first_over_time, last_over_timeFirst/last value

Aggregation Operators

sum, avg, min, max, count, stddev, topk, bottomk, approx_topk, sort, sort_desc

With grouping: sum by (label1, label2) or sum without (label1)

Conversion Functions

FunctionDescription
duration_seconds(label)Convert duration string
bytes(label)Convert byte string (KB, MB)

label_replace()

label_replace(rate({job="api"} |= "err" [1m]), "foo", "$1", "service", "(.*):.*")

Parser Reference

logfmt

| logfmt [--strict] [--keep-empty]
  • --strict: Error on malformed entries
  • --keep-empty: Keep standalone keys

JSON

| json                                           # All fields
| json method="request.method", status="response.status"  # Specific fields
| json servers[0], headers="request.headers[\"User-Agent\"]"  # Nested/array

Template Functions

Common 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

references

best_practices.md

function_reference.md

SKILL.md

tile.json