logwarden
A guardrail for logs. logwarden reads the JSON logs your service actually writes and flags every line that would make debugging harder: ad-hoc field names, missing service info, free-text events, and errors that don't say what failed. It exits with code 1 on problems, so CI and AI agents can use it the way they use tests.
It checks output, not source code, so it works for any language. Field names follow OpenTelemetry semantic conventions, the names traces and metrics already use, so logs, traces and metrics can be queried together.
$ uvx logwarden check logs.jsonl
logwarden: 573 records, 2843 violations
539 adr_event_name - Event is a constant snake_case name
fix: Use a fixed name like import_completed and move variable data into fields
e.g. §4: event 'Loaded 3 models' must be a constant snake_case name
findings (first 20):
line 1 adr_event_name §4: event 'Loaded 3 models' must be a constant snake_case name
What it checks
| Rule | Fails on |
|---|---|
adr_banned_synonym |
status=500 instead of http.response.status_code=500 |
adr_semconv_prefix |
http_route instead of http.route |
missing_attribute |
a field that isn't semconv and isn't declared by the project |
deprecated |
a renamed semconv field (gen_ai.system) |
adr_missing_required |
no service.name, service.version or deployment.environment.name |
adr_environment_value |
dev instead of development |
adr_event_name |
event="Loaded 3 models" instead of models_loaded |
adr_failure_context |
an error line without exception.type, error.type or a status code |
The standard is in docs/standard.md, and each rule's fix is in docs/rules.md.
Use it in a project
uv add --dev logwarden # or: pipx install logwarden / uvx logwarden
logwarden init --agent # fields file + AGENTS.md section
LOGWARDEN_CAPTURE=logs.jsonl pytest # capture logs (pytest plugin, auto-registered)
logwarden check logs.jsonl # check them
# CI
- uses: Ingeniator/logwarden@v0.3.0
with:
logs: logs.jsonl
Project settings go in [tool.logwarden] in pyproject.toml, or in logwarden.toml.
See docs/integration.md for capturing logs from any stack,
project-only fields and migrating a legacy service.
For AI agents
- Claude Code:
/plugin marketplace add Ingeniator/logwarden, then/plugin install logwarden@logwarden. This gives a skill for writing good logs, the MCP server and/logwarden:check. - Other agents:
logwarden init --agentadds a logwarden section toAGENTS.md. The MCP server runs withuvx --from 'logwarden[mcp]' logwarden mcpand providescheck_logs,explain_rule,list_rulesandget_standard. - Machine output:
logwarden check --jsongives each finding's line number, rule and fix hint. - Agents working on this repo: read AGENTS.md.
How it works
Each log line becomes a sample for OTel Weaver
registry live-check. Weaver checks the sample's field names against the semconv
registry (plus logwarden's shared fields and the project's logwarden-fields.yaml) and
runs the rules in src/logwarden/_data/policies/logwarden.rego. Python 3.10+ on Linux,
macOS or Windows. Weaver is downloaded on first use and checked against its published
SHA-256.
Not covered yet
See docs/roadmap.md. Next up: baseline mode for legacy services, a sensitive-data rule, non-JSON lines, and a logging-setup library. Release notes are in CHANGELOG.md.
License
Metadata
Release files for logwarden 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logwarden-0.3.0.tar.gz | 38.5 kB | With provenance | Details for logwarden-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logwarden-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for logwarden-0.3.0-py3-none-any.whl |
Total release size: 70.1 kB
Release files / logwarden-0.3.0.tar.gz
| Download URL | logwarden-0.3.0.tar.gz |
|---|---|
| Size | 38.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2074c7e8ad75116b5397e231da69ac7835596d9d7511e5bedbf46da8b99cf252
|
|
BLAKE2b-256 checksum How to use checksums |
00da1deb93d7b80350a4867ae300463afe640b8d46ff71dccac22e07741c08d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / logwarden-0.3.0-py3-none-any.whl
| Download URL | logwarden-0.3.0-py3-none-any.whl |
|---|---|
| Size | 31.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
237e3c78e0c709b01f5e4b9fc3a520d1b8a2c97a1ae770eb9b2a9879c031dd59
|
|
BLAKE2b-256 checksum How to use checksums |
11bda50716042657455cb1e37f6b7fd7077a0c92ef6ef9c6b1b1a5c41953d73b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for logwarden 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for logwarden-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.