Skip to content

AlertLint · Observability

Test your Loki alerting rules before they fire in production.

AlertLint lets you test Loki alerting rules before production — paste your rules and synthetic logs, assert which alerts should fire, and get a pass or fail, all online with no install or signup.

Runs in your browser No signup Free & open Updated Jul 19, 2026

AlertLint playground

rules.yaml

Runs in your browser — nothing is uploaded.

Tip: press Esc to release focus.

test.yaml
Results

Load an example or paste your own rules, then run to see pass/fail results here.

The Gap

Loki has no promtool.

Prometheus engineers have shipped tested alerting rules for years with promtool test rules — synthetic samples in, a pass or fail out. Loki adopted the same rule format but never shipped the test runner, so LogQL alerts have shipped untested: the only way to know whether a rule fired was to wait for production traffic.

The community has asked for this for years — see Loki issue #7655 and issue #16659. AlertLint closes that gap today: a free browser-based Loki alerting rule unit tester that uses the familiar promtool-style test file and runs entirely client-side.

New to the format? Jump to the two files or try the live playground above.

The Pipeline

How it works.

Five deterministic steps run end-to-end on every press of Run — all inside your browser tab, every time.

  1. Parse the rules.

    Your Loki ruler YAML is parsed into alerting and recording rule groups — the same shape the Loki ruler loads.

  2. Parse the test file.

    The promtool-modeled test file is read for its input log series, evaluation interval, and the alerts you expect.

  3. Build an in-memory store.

    Synthetic log lines are loaded into an ephemeral, in-browser log store so queries have something to read.

  4. Evaluate the LogQL.

    Each rule expression runs against the store at the test evaluation time, producing the alerts that would fire.

  5. Diff against expected.

    Actual alerts are diffed against your exp_alerts. Any mismatch is a failing case, reported inline.

File Formats

Two files, both familiar.

AlertLint reads exactly two inputs: your Loki ruler YAML and a promtool-modeled test file. If you have written either for Prometheus or Loki before, these will feel like home.

The rule file

Standard Loki ruler YAML — groups of alerting and recording rules, each with a LogQL expr, an optional for duration, and labels / annotations. This is the same file your ruler already loads.

rules.yaml
groups:
  - name: app-errors
    rules:
      - alert: HighErrorRate
        expr: |
          sum(rate({app="checkout"} |= "error" [5m])) > 0.2
        for: 2m
        labels:
          severity: page
        annotations:
          summary: "Checkout error rate is high"

The test file

Modeled on promtool: input_series of synthetic log streams, an evaluation interval, and an alert_rule_test listing the alerts you expect. An empty exp_alerts: [] asserts that no alert fires.

tests.yaml
tests:
  - interval: 1m
    input_series:
      - stream: '{app="checkout"}'
        # 5 error lines/min for 6 minutes
        values: '{level="error"}x6'
    alert_rule_test:
      - eval_time: 6m
        alertname: HighErrorRate
        exp_alerts:
          - exp_labels:
              severity: page
              app: checkout
            exp_annotations:
              summary: "Checkout error rate is high"

  # Negative case — empty exp_alerts asserts NO alert fires.
  - interval: 1m
    input_series:
      - stream: '{app="checkout"}'
        values: '{level="info"}x6'
    alert_rule_test:
      - eval_time: 6m
        alertname: HighErrorRate
        exp_alerts: []

Coming Soon

Run the same checks in CI.

The browser engine is step one. A drop-in CLI will run the identical assertions over a glob of test files in your pipeline, so a broken alert fails the build instead of paging you at 3 a.m.

A first-party GitHub Action that wraps the CLI is planned alongside it. Both are coming soon — the in-browser tester above works today.

ci.sh
# Coming soon — the same engine as a CLI
$ alertlint test ./tests/**.yaml

  ✓ app-errors › HighErrorRate (fires)
  ✓ app-errors › HighErrorRate (no-fire on info logs)

  2 passed, 0 failed

Preview Engine

A note on accuracy: the in-browser evaluator is a preview engine that covers the common LogQL alerting patterns — label matchers, line and label filters, rate / count_over_time aggregations, and threshold comparisons. A full-parity build that compiles the upstream Loki query engine to WebAssembly is coming soon. Until then, treat a green run as strong pre-flight confidence rather than a byte-for-byte production replay.

FAQ

Questions, answered.

Tap a question to expand the answer.

AlertLint is a free, browser-based unit tester for Grafana Loki alerting and recording rules. You paste your Loki ruler YAML plus a promtool-modeled test file with synthetic log streams, press Run, and AlertLint evaluates the LogQL and reports whether the alerts you expected actually fired. It is the promtool “test rules” equivalent that Loki never shipped.

No. AlertLint runs 100% client-side. Your rules and synthetic logs are evaluated in your browser tab — nothing is uploaded to a server, and there is no account or signup. You can safely use it on internal or sensitive rule definitions.

Prometheus ships promtool test rules to unit-test alerting rules against synthetic samples. Loki has no built-in equivalent — there is no loki test command. AlertLint fills that gap for LogQL: you assert which alerts should fire from a given set of log lines, before the rules ever reach production.

The preview evaluator covers the common alerting and recording patterns — log and metric queries, stream selectors, label matchers, line filters, rate and count_over_time aggregations, sum aggregations, and threshold comparisons against expected alerts. Full parity with the upstream Loki query engine (compiled Go to WebAssembly) is planned for a future release.

Yes. An empty exp_alerts list on a test case asserts that the rule produces no alerts at the evaluation time — the same negative-case semantics promtool uses. It is the canonical way to prove a rule will not fire on benign log volume.

No. AlertLint is an independent, community tool and is not affiliated with or endorsed by Grafana Labs. Loki and Grafana are trademarks of Raintank, Inc. AlertLint models the promtool test-file format for familiarity and uses the vendor names only to describe what it tests.

Before deploying, lint your rules YAML with lokitool rules lint or cortextool rules lint --backend=loki and dry-run your queries in Grafana Explore or logcli. For assertion-style pre-flight testing — the step those tools do not cover — paste your rules plus synthetic log streams into AlertLint and assert which alerts should fire, including negative cases. A green run gives strong pre-flight confidence, though the in-browser evaluator is a preview engine rather than a full production replay.

lokitool and cortextool offer rules lint and sync commands that validate rule structure and push rules to a Loki ruler — but neither runs synthetic-log alert assertions or tells you whether a rule fires. AlertLint brings the promtool-style, assertion-based workflow to LogQL: you supply synthetic log streams, declare which alerts you expect, and get a pass or fail verdict, entirely in the browser with no install.

AlertLint parses standard Loki ruler YAML — groups of alerting and recording rules, each with a LogQL expr, optional for duration, and labels/annotations — and reports structural problems inline. For deeper expression-policy checks against rule metadata, promruval with --support-loki is a CLI option. AlertLint runs fully in the browser with no signup required.

More free, private DevOps tools.

AlertLint is one tool in OpsCanopy — a growing canopy of browser-based validators, converters and testers that never touch a server.

29 free tools, every one offline-capable — opscanopy.com works with no signup and nothing uploaded.

Author the upstream queries with the LogQLPromQL Helper and route the alerts downstream with the Alertmanager Route Tester, pair it with the now-live CVE-ignore converter and GitHub Actions validator, or browse the full tools directory.

Not affiliated with or endorsed by Grafana Labs. Loki and Grafana are trademarks of Raintank, Inc.