Skip to content

logwarden v0.10.1

Choose a tag to compare

@github-actions github-actions released this 22 Nov 16:27
· 15 commits to main since this release
d4d79aa

logwarden v0.10.1

Status: Released 2026-11-22 · tag v0.10.1

Outcome: logwarden passes its own standard, and it's fast enough to check a large log
file in CI.
Two gaps found when we reviewed whether the tool is ready for production:

  • logwarden's own messages were plain text on stderr, so logwarden failed its own standard. Checked
    with logwarden, two download messages gave two adr_non_json_line findings, a rule in the
    essential profile.
  • A check took about 9 ms per log line (10,000 lines took 89 s), so a CI job with a large test
    log took minutes. About 7 ms of that went to logwarden's sensitive-data rules: Weaver's Rego
    engine runs each regular expression on every value.

What's new

  • JSON messages: LOGWARDEN_LOG_FORMAT=json (or --log-format json). Every message
    logwarden writes to stderr becomes one JSON record that passes the standard, even with the
    standard profile. This includes progress, warnings, errors, invalid arguments, a crash, and
    third-party library lines in logwarden mcp.
    • Each record has timestamp, level, a constant snake_case event (for example
      weaver_download_started, logs_fetched, command_failed), logger,
      service.name=logwarden, service.version, deployment.environment.name and
      logwarden_detail, which holds the same text as the plain-text message.
    • Warnings and errors add error.type. A crash adds exception.type, exception.message and
      exception.stacktrace.
    • The environment comes from DEPLOYMENT_ENVIRONMENT or OTEL_RESOURCE_ATTRIBUTES, as for
      configure(). Without either it is production.
    • logwarden_detail is declared in logwarden's registry, so a check of logs that include
      logwarden's own records needs no fields file.
    • The records go to stderr, not stdout: stdout carries the result (--json, the MCP
      protocol). Container platforms collect both.
  • The Docker image writes JSON messages by default. Its output usually ends up in a log
    pipeline. The GitLab template sets LOGWARDEN_LOG_FORMAT: text, so job logs stay readable.
    Outside the image, plain text stays the default.
  • Faster checks. Findings are the same as before; three changes make them cheaper:
    • Each sensitive-data rule first looks for text that any match must contain, such as @ for
      an email address, eyJ for a JWT, or 13 digits in a row for a card number. The regular
      expression runs only when that text is present.
    • Each distinct field value (name, type, value) is checked once, and so is each distinct line
      shape (event, level, whether the trace context is valid, field names). Each line's findings
      are put back together from those results. Weaver judges every field on its own, and the
      per-line rules read only the shape, so the result is the same.
    • Large inputs are checked by several Weaver processes in parallel (up to 8), one chunk each.

Changes you might notice

  • With -o DIR, samples.json and live_check.json hold what Weaver was given: each distinct
    field and line shape once, not one sample per line.
  • With the Docker image, messages on stderr are JSON unless you set
    LOGWARDEN_LOG_FORMAT=text. The wording and layout of messages are not part of the public
    interface (STABILITY.md), and the GitLab template keeps plain text.

Breaking changes

None.

Verification

# Claim How it will be checked Result
1 JSON messages pass the standard Self-check test: with LOGWARDEN_LOG_FORMAT=json, collect stderr from check (a run with -o, a missing file), fetch against an unreachable server, an invalid argument, capture with a command, setup, and a crash. Then run logwarden check --profile standard on it: 0 findings, and the records include each expected event. --log-format json works the same. Text mode output is unchanged ✅ tests/test_selflog.py: with LOGWARDEN_LOG_FORMAT=json, stderr of check -o with a config warning, a missing file, an invalid --profile, fetch against a closed port, setup, capture -- python -c pass (no records), a crash, both download messages and third-party lines (info, warning, exception) is all JSON, has the events config_warning, output_written, command_failed (usage_error, invalid_arguments), semconv_ready, capture_started, capture_finished, command_crashed (with exception.stacktrace), weaver_download_started, semconv_download_started, library_log, and check --profile standard on it reports 0 violations. --log-format json works before and after the command and as --log-format=json; an invalid value exits 2; the environment comes from OTEL_RESOURCE_ATTRIBUTES. Text mode: logwarden: check: no such file: missing.jsonl, as in 0.10.0
2 logwarden mcp The MCP server in JSON mode: start it, call list_rules over stdio, and stop it. Its stderr, including the MCP library's lines, passes --profile standard, and stdout is only the protocol ✅ logwarden mcp in JSON mode with an empty cache, driven over stdio (initialize, a malformed line, check_logs): stdout had only the 2 protocol responses; stderr had weaver_download_started and semconv_download_started records, and check --profile standard on it: 2 records, 0 violations. The MCP library wrote nothing to stderr, even for the malformed line, so its routing is covered by the library_log lines of claim 1
3 Same findings The --json result before and after this change, for examples/ (goldens unchanged except the version), the real-service samples of v0.10.0 (databridge, yallmp-sync), and a generated file with secrets, emails, card numbers, JWTs, keys and nested JSON: identical findings, both with one Weaver process and with chunks ✅ Full findings (rule, level, line, field, message, event) of 0.10.0 recorded before the change, for examples/ (15), databridge (481), yallmp-sync (3,084, two captures) and a generated file of 919 lines with each kind of secret, email, card number (valid, invalid, with spaces and dashes, as numbers), JWT, key prefix, nested JSON and sensitive or harmless key names (2,016): identical after each step (guards; field and shape deduplication; parallel chunks), with one Weaver process and with chunks forced. The generated file is now a test against 0.10.0's findings (tests/test_same_findings.py, both modes). Goldens: only the version changed (make golden, reviewed)
4 Faster --profile essential on 1,000, 10,000 and 100,000 generated lines: time before and after on a laptop (8 cores) and on a GitHub Linux runner. Target: 100,000 lines in under 60 s on both ✅ Before (0.10.0, laptop, 8 cores): 1,000 lines 9.4 s, 10,000 lines 89 s, 200,000 lines not done after 10 min (stopped). After, laptop: 1,000 lines 1.5 s, 10,000 lines 2.0 s, 100,000 lines 14.3 s (scripts/speed.py: 7 fields per line, ids unique). GitHub Linux runner, new CI job speed: 100,000 lines in 13.3 s (run 45040879771). Worst case, every field value unique on every line (trace ids, UUIDs, random numbers; 7 per line), laptop: 100,000 lines in about 70 s, so above 60 s: there is nothing to deduplicate and Weaver's own cost per value remains. Typical logs repeat most values
5 Image and template The image built from this change writes JSON to stderr by default, LOGWARDEN_LOG_FORMAT=text restores plain text, and the GitLab template sets text ✅ Image built from this change (--network none): check missing.jsonl writes a command_failed JSON record and exits 2; with -e LOGWARDEN_LOG_FORMAT=text it writes logwarden: check: no such file: missing.jsonl. The image's own stderr (output_written, command_failed) checked by the image with --profile standard: 0 violations. The GitLab template sets LOGWARDEN_LOG_FORMAT: text in both jobs
6 Docs, CI, release STABILITY.md (env var), docs/integration.md, AGENTS.md; CI on Linux, macOS and Windows; dry run to TestPyPI; after the tag, PyPI and the image ✅ STABILITY.md (env var; event names of the JSON records), docs/integration.md, AGENTS.md (selflog.py, the stderr rule, the speed rules for new Rego rules) updated; strict site build passes; CI run 45040879771 (PR #8: Linux, macOS, Windows, coverage 93%, speed) passed. Dry run and after the tag: see below