Skip to content

logwarden v0.6.0

Choose a tag to compare

@github-actions github-actions released this 19 Nov 07:04
· 61 commits to main since this release

logwarden v0.6.0

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

Any language: check services written in Node, Go, Java or anything with an OpenTelemetry
SDK, run logwarden without Python, and catch problems in source before anything runs.

What's new

  • logwarden capture: receive logs over OTLP. A small OTLP/HTTP receiver (port 4318,
    protobuf and JSON encodings, no extra dependencies). Each OTLP log record becomes one line
    in the standard's shape: resource attributes (service.name, …) merged in, event from
    the record's event name or string body, level from the severity, logger from the
    instrumentation scope, W3C trace_id/span_id, attributes as fields. The lines go
    through the same check (baseline, disable, upstreams all apply).

    logwarden capture -o logs.jsonl -- npm test     # runs the command with OTEL_* pointing at the receiver, then checks
    logwarden capture -o logs.jsonl                  # or receive until Ctrl-C / SIGTERM

    With a command, it listens on a free port, sets OTEL_EXPORTER_OTLP_ENDPOINT,
    OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf (an existing http/json is kept) and
    OTEL_LOGS_EXPORTER=otlp, runs it, then runs check on what arrived. The exit code is
    the command's if it failed, otherwise the check's; no records at all is a setup error
    (exit 2). The command's stdout goes to stderr, so --json stays parseable. Requests may
    be gzip/deflate-compressed or chunked; traces and metrics sent to the same endpoint are
    accepted and ignored. Attributes with an empty OTLP value are left out, and a non-string
    body next to an event name goes to log.record.original. --host 0.0.0.0 for containers.
    (The roadmap said Weaver's live-check receiver. Weaver judges OTLP records directly but
    returns no lines, so the baseline, line numbers and upstream coverage wouldn't work there.
    gRPC isn't supported; SDKs default to it in some languages, so set the protocol to
    http/protobuf, which capture -- cmd does.)

  • Docker image ghcr.io/ingeniator/logwarden:0.6.0 (and :latest), linux/amd64 and
    linux/arm64, with Weaver and the semantic conventions inside, so it works offline:

    docker run --rm -v "$PWD:/work" ghcr.io/ingeniator/logwarden:0.6.0 check logs.jsonl

    It runs as any user (--user $(id -u)), with the cache read-only.

  • Setup recipes for Node (pino), Go (log/slog) and Java (logback +
    logstash-logback-encoder) in docs/recipes/, each with a runnable example in
    examples/recipes/ whose output passes the check. The Node recipe also shows the
    OTLP route through logwarden capture.

  • Source checks: logwarden lint-code [PATHS] runs Semgrep with
    logwarden's rules (_data/semgrep/logwarden.yml) for Python, JavaScript/TypeScript, Go
    and Java. Semgrep needs one rule per language, so each check has four ids with a
    -python, -js, -go or -java suffix (16 rules):

    • logwarden-event-name-* (§4): a formatted log message (f-string, %, .format, +,
      template literal, fmt.Sprintf, String.format) or a literal one that isn't
      snake_case ("Imported rows", SLF4J "Imported {} rows"), as the runtime
      adr_event_name rule would report it.
    • logwarden-sensitive-key-* (§8): a field named like password/token/api_key.
    • logwarden-banned-key-* (§2): a banned synonym as a field name (same list as the
      runtime rule).
    • logwarden-print-* (§1, warning): print to stdout, console.log, fmt.Println,
      System.out.println, printStackTrace() instead of the logger; test files, scripts/,
      cmd/ and cli.py are skipped.

    --json, --exclude-rule ID (repeatable) and --list. Semgrep isn't a dependency: it
    pins old OpenTelemetry and mcp versions that would clash with a project's (and with
    logwarden[mcp]), so there is no [lint] extra. lint-code uses semgrep from PATH,
    or runs a pinned Semgrep with uvx when uv is installed. Semgrep doesn't run natively on
    Windows. Like Semgrep, it skips tests/ directories. Exit codes as for check: 0 clean,
    1 findings, 2 setup error.

Fixes

  • A read-only cache broke every check. logwarden made the cached Weaver binary
    executable on each run, which fails when the cache belongs to another user (found by
    running the Docker image as non-root). It now only does so when needed.
  • logwarden setup also downloads the semantic conventions, so a machine (or image) can be
    prepared for offline use in one step.

Breaking changes

None. The core install still has no dependencies besides tomli on Python 3.10.

Upgrading from v0.5.0

Nothing to change. For other languages, follow docs/recipes/, then either write JSON
lines to a file and run check, or wrap the test command in logwarden capture -- ....
CI: uses: Ingeniator/logwarden@v0.6.0, or the Docker image.

Verification

CI run 44474028330 (commit 54d3055): 155 tests passed on ubuntu py3.10, ubuntu py3.13 and
macos py3.13; on windows py3.13 151 passed and 4 were skipped (POSIX signal/permission tests,
and the two Semgrep runs: Semgrep has no Windows build). The action, package, plugin,
recipes and docker jobs passed.

# Claim How it was checked Result
1 OTLP protobuf and JSON are received and converted test_claim1_python_sdk_protobuf: the Python OTel SDK's http/protobuf exporter sends 2 records; the lines have service.*, event, level, logger, a 32/16-hex trace_id/span_id, server.address, exception.type, and pass check with 0 violations. OTLP/JSON from a real SDK: Node's @opentelemetry/exporter-logs-otlp-http (chunked) in the recipe (claim 6). test_claim1_json_encoding: a hand-built OTLP/JSON request with every value type converts to exactly the expected line ✅
2 Conversion details test_claim2_*: severity numbers 1–24 and 0 map to debug/info/warning/error/critical/info; severity text wins (WARN→warning, TRACE→debug, Information→info, FATAL); unknown text falls back to the number; int (negative), bool, double, bytes (base64), array and map values; event name vs string body (body kept as log.record.original); map body → fields with its event; non-string body; all-zero trace id omitted; observed time used when time is unset; empty values left out ✅
3 capture -- cmd test_claim3_*: good logs → exit 0, bad → exit 1 with exactly adr_banned_synonym, adr_environment_value, adr_event_name; a command exiting 7 → 7; missing command → 2; no records → 2 (--no-check → 0); a command printing to stdout leaves --json stdout empty; gzip via OTEL_EXPORTER_OTLP_COMPRESSION, deflate and chunked requests accepted; unknown path 404, broken protobuf/JSON 400, traces/metrics 200 ✅
4 Receive until a signal test_claim4_until_sigterm (POSIX): background capture --port 0, 2 records sent, SIGTERM → exit 0, both lines in the file, check ran with 0 violations. In the container: docker stop → exit 0, "captured 2 log records", 0 violations (CI docker job) ✅
5 Docker image CI docker job: the linux/amd64 and linux/arm64 builds each downloaded their Weaver and ran a check in the image (1 records, 0 violations); --network none: bad.jsonl → exit 1 with 10 violations, good.jsonl → 0, also with --user 12345; capture --host 0.0.0.0 in the container received the host's logs. Dry run pushed ghcr.io/ingeniator/logwarden:0.6.0.dev7 (manifest: amd64, arm64), pulled anonymously and run natively on arm64: version 0.6.0.dev7, bad.jsonl 10 violations, good.jsonl clean offline as --user 4242 ✅
6 Node recipe CI recipes job (examples/recipes/check.sh): pino stdout → 3 records, 0 violations; OTLP via instrumentation-pino through logwarden capture -- node --require ./otel.js app.js → captured 3 records, 0 violations ✅
7 Go recipe CI recipes job: go run . (slog, Go 1.23) → 3 records, 0 violations ✅
8 Java recipe CI recipes job: mvn compile exec:java (logback 1.6.7, logstash-logback-encoder 9.0, Temurin 21) → 3 records, 0 violations ✅
9 Semgrep rules test_claim9_semgrep_test: semgrep --test → "16/16: ✓ All tests passed"; test_claim9_every_rule_has_fixtures: each of the 16 rules has ruleid: and ok: lines; banned-key regex equals the Rego banned set; the sensitive-key regex agrees with patterns.is_sensitive_key on 15 names ✅
10 lint-code test_claim10_*: fixtures → exit 1 with exactly the 37 annotated findings, each with the source line; recipes and src/logwarden → 0 findings (also the CI recipes job); --exclude-rule of all four Python rules → 0; unknown --exclude-rule → 2; --list → 16 ids; unrunnable Semgrep → 2 with the install hint; uvx fallback when Semgrep isn't installed (CI ran Semgrep this way). TestPyPI 0.6.0.dev7 with uvx in a clean environment: 37 findings on the fixtures ✅
11 Docs and wiring docs/recipes/{node,go,java}.md; docs/integration.md (Docker, recipes, OTLP capture, lint-code); README; skill and AGENTS.snippet.md (lint-code, capture); AGENTS.md (layout, commands, Semgrep constraints, image release); roadmap M4 marked done; test_docs_name_this_version checks the @v, == and image tags ✅
12 CI green; release publishes PyPI and the image CI above. Dry run: release run 44475098046 published 0.6.0.dev7 to TestPyPI and pushed the image; from TestPyPI in a clean environment capture -- <python OTel app> → 2 records, 0 violations. Real publish: checked after the tag ✅ dry run · ⏳ PyPI and image