Skip to content

logwarden v0.7.0

Status: Released 2026-11-19 · tag v0.7.0.

Review: show what a change does to the logs. Compare a run with the base branch, read the result as an HTML report or a pull-request comment, and keep a catalog of the events a service emits.

What's new

  • Snapshots and comparison with the base branch.
logwarden check logs.jsonl --snapshot base.json          # on main: save what this run found
logwarden check logs.jsonl --compare base.json           # on a branch: what's new, what's fixed
  • A snapshot records each finding and each event name seen, with counts. Findings are matched by the same key as the baseline (rule, field, logger, event), not by line number, so a moved line isn't "new".
  • --compare adds a compare key to the --json result: {base, new, fixed, unchanged, new_findings, fixed_entries, new_events, gone_events}. The text output gets one line: compared with base.json: 2 new, 1 fixed.
  • --compare also accepts a baseline file, since both list findings the same way.
  • --compare only reports. The exit code still comes from the violations after disable and the baseline. To fail only on new findings, use the baseline, as before.
  • HTML report: check --html report.html. One self-contained file (no scripts, no external CSS or fonts) that works offline and as a CI artifact. It contains:
  • the totals;
  • the comparison, when there is one;
  • one section per rule with its title, fix hint and a link to docs/rules.md at this version;
  • every finding with its line number;
  • the event catalog of the run.

It uses light and dark themes. Everything is HTML-escaped, and like the text output it never shows logged values, only messages, which never contain them. -o DIR now also writes report.html, report.md and snapshot.json. - Markdown summary and PR comment. check --markdown FILE writes a short summary: - status and counts; - new and fixed findings when comparing; - a table by rule with fix hints; - the first new findings; - new event names.

It stays under GitHub's comment size limit. The GitHub Action uses it:

permissions:
  contents: read
  pull-requests: write        # only for comment: "true"
steps:
  - uses: Ingeniator/logwarden@v0.7.0
    with:
      logs: logs.jsonl
      comment: "true"         # one comment per PR, updated on each push

New Action inputs, each with a default that keeps the current behaviour: - compare (default auto). On a push, the Action saves the run's snapshot to the Actions cache. On a pull request, it restores the base branch's latest snapshot and compares with it. GitHub lets a pull request read the base branch's cache, so no artifact juggling or extra tokens are needed. It can also be a snapshot path, or "false" to turn comparing off. - comment (default "false"). Posts the Markdown summary as a single comment and updates it on later pushes. It finds that comment by a hidden marker. Without write permission (pull requests from forks), it prints a warning instead of failing the step. - upload (default "true"). Uploads logwarden.report/ (HTML, Markdown, JSON, snapshot) as the artifact logwarden-report.

  • snapshot-id (default: the job id) and artifact-name (default logwarden-report). Set these when a job checks several log files, so their snapshots and artifacts stay separate.
  • token (default github.token), used for the comment.

The job summary now shows the Markdown summary instead of the plain text. New outputs: violations, new and fixed. The step's exit code is decided in a last step, so the comment and the upload also happen when the check fails.

On other CI systems, --snapshot, --compare, --markdown and --html work the same way (docs/integration.md shows GitLab). - Event catalog. - logwarden catalog logs.jsonl lists every event name in a run. For each one it shows the count, levels, loggers and fields, and the first line where it appears. Use --json for machine-readable output and --markdown for docs. - catalog logs.jsonl -o logwarden-events.toml writes a catalog file to commit and describe:

```toml
[events.order_imported]
description = "An order file was parsed and stored."
levels = ["info"]
```

Running it again adds new events and keeps existing descriptions. Events that a run
didn't produce are kept too, because one run rarely covers every path.
  • New rule adr_event_catalog (§4). With events = "logwarden-events.toml" in the config, check reports each event that isn't in the catalog. It runs only when a catalog is configured, like upstreams. Event names then stay a reviewed list, so dashboards and alerts that match on them don't silently break.
  • The catalog is TOML, so it needs no new dependency: Python 3.11+ reads it natively, and tomli already covers 3.10.

Breaking changes

None. The new --json key and the Action inputs are additions, and exit codes don't change. The core install still has no dependencies besides tomli on Python 3.10.

Upgrading from v0.6.0

Bump uses: Ingeniator/logwarden@v0.7.0. Comparison starts working once one push to the base branch has saved a snapshot. Add comment: "true" and pull-requests: write for the PR comment. To start a catalog, run logwarden catalog logs.jsonl -o logwarden-events.toml, fill in the descriptions, then set events = "logwarden-events.toml".

Verification

CI run 44599357676 (commit 4374f0e): 174 tests passed on ubuntu py3.10, ubuntu py3.13 and macos py3.13; on windows py3.13 170 passed and 4 were skipped (the same POSIX and Semgrep tests as in v0.6.0). The action, review, package, plugin, recipes and docker jobs passed.

# Claim How it was checked Result
1 Snapshot and compare test_claim1_new_fixed_unchanged: a base with A (banned synonym) and B (bad event name) and a run with B (moved from line 3 to 1) and C (secret) give exactly 1 new (C, line 3), 1 fixed (A) and 1 unchanged (B); new event c_done, gone a_done; the text line compared with base.json: 1 new, 1 fixed, 1 unchanged; exit code and result identical to a run without --compare apart from the compare key. test_claim1_disable_and_baseline_file: a disabled rule isn't counted; a baseline file works as --compare (events null). test_claim1_bad_compare_file: missing, empty, non-JSON, incomplete entry and bad events → exit 2 ✅
2 HTML report test_claim2_html_report: bad.jsonl → every rule and a row per finding, parses as HTML, no script/link/img tags, every link goes to github.com/Ingeniator/logwarden/blob/, no comparison section without --compare. test_claim2_escaping_and_compare_section: an event <script>alert(1)</script> and a field x<b> with an <img onerror> value come out escaped in the HTML and the Markdown. test_claim2_o_dir_writes_reports. Rendered in Chrome: light and dark themes, and at 360px wide the page doesn't scroll sideways (tables scroll inside their box). Rule ids in table cells no longer break mid-word, and the message column keeps a minimum width; both fixed after the first render ✅
3 Markdown summary test_claim3_markdown_golden: bad.jsonl compared with good.jsonl's snapshot matches tests/golden/bad-vs-good.md (new golden, make golden). test_claim3_markdown_fits_a_comment: 10,000 findings, 200 rules and long names → at most 60,000 characters with "more new findings"; with a 2,000-character limit it is cut with a note ✅
4 Action: compare through the cache, PR comment Throwaway PR #1 (closed, not merged). tests/data/review.jsonl on main has one known finding; the review job on main saved logwarden-snapshot-review-main-44594795688-1. Push 1 added a line with event Order Imported: run 44596340446 restored that cache entry and posted comment 7019522053: 1 new (adr_event_name, line 3), 0 fixed, 1 unchanged, new event Order Imported. The artifact logwarden-report had report.html, report.md, result.json, snapshot.json. Push 2 fixed both lines: run 44597752545 updated the same comment (id 7019522053): 0 new, 1 fixed (adr_banned_synonym/status), no violations. review-readonly (pull-requests: read, comment: "true") got HTTP 403, logged the warning and passed. The action job (defaults on good.jsonl, plus bad.jsonl with fail: "false" and failing) passed as before, with outputs violations 0 and 10. The job summary gets report.md. This was checked by running the step script locally with a fake GITHUB_STEP_SUMMARY, for push, for a pull request and for a pull request with no base snapshot (a notice); it wasn't read back from the GitHub UI ✅
5 Event catalog test_claim5_catalog_lists_events: catalog examples/good.jsonl --json gives exactly the 2 expected events (count, levels, loggers, fields, first line); text and Markdown output. test_claim5_catalog_file_merges: -o writes TOML that reads back; a second run keeps a hand-written description and an extra key, keeps an event the run didn't produce, adds a level and a new event with a name that needs quoting. test_claim5_broken_catalog_file → exit 2 ✅
6 Rule adr_event_catalog test_claim6_event_not_in_catalog: with events = "ev.toml" an unlisted event gives 1 violation on its line, and a non-snake_case event isn't reported twice; without the config the rule doesn't run; baseline and disable apply. test_claim6_bad_catalog_config: missing file, broken TOML, events = 1 → exit 2. test_rules_wired.py passes (rules.json, docs/rules.md, the standard §4, README table) ✅
7 Docs and wiring docs/integration.md (review section: compare, reports, Action inputs, GitLab; events in the config section), README, skill, AGENTS.snippet.md, AGENTS.md (layout, constraints), roadmap M5 done; test_docs_name_this_version passes for 0.7.0. The GitLab example is not run in CI ✅
8 CI green; release publishes CI above. Dry run: release run 44600643225 published 0.7.0.dev9 to TestPyPI and pushed the image :0.7.0.dev9. From TestPyPI in a clean venv with an empty cache (Weaver and semconv downloaded): --snapshot/--compare → 10 violations, 10 new, new events Loaded 3 models, user_logged_in; --html, --markdown and -o wrote their files; catalog -o wrote the catalog and check then reported adr_event_catalog; the MCP server lists its 4 tools and explain_rule adr_event_catalog returns the new section. The image, offline as --user 4242: --compare and --html work. Real publish: tag v0.7.0 → release run 44602822131 published 0.7.0 to PyPI, pushed ghcr.io/ingeniator/logwarden:0.7.0 and :latest (both report 0.7.0) and created the GitHub release. From PyPI in a clean environment with an empty cache: uvx logwarden==0.7.0 snapshot of good.jsonl, then bad.jsonl --compare → 10 violations, 10 new, new events Loaded 3 models, user_logged_in; --html and --markdown wrote their files; catalog lists 2 events; logwarden[mcp]==0.7.0 serves its 4 tools. The image :0.7.0, offline as --user 4242: the same comparison ✅