audit-framework-jsonl
An append-only JSON-Lines file sink for
audit-framework — and the reference implementation
every other ExternalSink (Splunk HEC, Elasticsearch, syslog, …) can be copied
from.
It implements the ExternalSink port: one compact JSON object per line,
appended to a file. Writes are serialised and offloaded off the event loop, with
optional rotation by date and/or size.
Install
pip install audit-framework-jsonl
Use
from audit_framework_jsonl.sink import JsonlFileSink
from audit_framework.core.middlewares.sink_fanout import SinkFanOutMiddleware
sink = JsonlFileSink("/var/log/audit/audit.jsonl", daily=True, max_bytes=50_000_000)
pipeline.use(SinkFanOutMiddleware([sink])) # fan events out to this sink
Or wire it by configuration through the registry — it advertises itself under
the audit_framework.plugins entry point as the file_jsonl external sink:
registry.discover_entrypoints() # finds file_jsonl
SinkClass = registry.get("external_sink", "file_jsonl")
sink = SinkClass("/var/log/audit/audit.jsonl")
Each emitted line is event.to_dict() serialised compactly, e.g.:
{"actor_id":"alice","action":"DELETE","resource_type":"contract","resource_id":"c-42",...}
Options
| Param | Effect |
|---|---|
name |
The sink_name used for per-policy sink filtering (default "file_jsonl"). |
daily |
Write to a date-stamped file audit-YYYY-MM-DD.jsonl (one per UTC day). |
max_bytes |
Roll the current file aside (audit.<timestamp>.jsonl) before it exceeds this size. Composes with daily. |
clock |
Injectable time source for rotation stamps (testing). |
Writing your own sink
sink.py is deliberately tiny — copy it and change four things:
- a stable
sink_name(matched againstAuditPolicy.sinks), async emit(event, context)— forwardevent.to_dict()to your platform (best-effort; raise on permanent failure so the pipeline records it),async health_check()— report reachability,- a
register(registry)that callsregistry.register("external_sink", "<name>", YourSink)(+ anaudit_framework.pluginsentry point inpyproject.toml).
Development
pip install -e ".[dev]"
pytest # 9 stdlib-only tests (tmp files; no infrastructure)
License
MIT
For AI agents & coding assistants
This package ships its agent guide — AGENTS.md — inside the
wheel (installed at <site-packages>/audit_framework_jsonl/AGENTS.md). Read it offline, with no
docs site and no network, even from an airgapped Nexus PyPI mirror:
python -m audit_framework_jsonl
python -c "import audit_framework_jsonl; print(audit_framework_jsonl.overview())"
AGENTS.md is the single source of truth: mental model, one runnable quickstart,
and the exact public API. audit_framework_jsonl.overview() returns it, and tests/guide_test.py
compiles its examples so the guide can't drift from the code.
Metadata
Release files for audit-framework-jsonl 0.1.1
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 | |
|---|---|---|---|---|
| audit_framework_jsonl-0.1.1.tar.gz | 8.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audit_framework_jsonl-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / audit_framework_jsonl-0.1.1.tar.gz
| Download URL | audit_framework_jsonl-0.1.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d1bdb456058957bccde9b36c81b6a6b2e127ed2794d7191cb2e303b128128b8
|
|
BLAKE2b-256 checksum How to use checksums |
71f39f67803c59ecc310aeefe51d5aaa9b98db673e861dc4a526971cd4848319
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 3, 2026.
Transparency logRelease files / audit_framework_jsonl-0.1.1-py3-none-any.whl
| Download URL | audit_framework_jsonl-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9b43fa0e71c2b5ab7418d7bcefa14e2889c764fb58f0eb405621c1ce8b21214
|
|
BLAKE2b-256 checksum How to use checksums |
638bf7364b32f43609f1b13ddf1da01664405782bdbfde06e30c9513c53afe29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 3, 2026.
Transparency logSecurity for audit-framework-jsonl 0.1.1
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for audit_framework_jsonl-0.1.1.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 Jul 3, 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.