This release is a pre-release and may not be stable for production use.
sec-audit-logging
Framework-free structured audit logging for the sec-audit
core. Emits OpenTelemetry LogRecord-shaped
JSONL — one JSON object per line — ready for Loki/Grafana, Wazuh, or any SIEM.
This package is Django-free. For Django integration use
django-sec-audit,
which depends on this package.
Features
- OTel JSONL formatter —
JSONLLogFormatterrenders the OTel LogRecord envelope (timestamp,severity_*,resource,attributes, …) as a single JSON line. - Scrubbing — sensitive keys/value patterns are redacted before emission; cycle- and shared-reference-safe.
- Projection limits — bounds nesting depth, string sizes, and record bytes with a graceful multi-tier fallback so a single oversized record never breaks the stream.
- Filter / enricher pipeline — pluggable callables run before emission.
- Handlers — works with stdlib
StreamHandler(stdout) andRotatingFileHandler(file). - Loki examples — ships Grafana Alloy / Loki / Grafana templates and the
sec-audit-loki-initgenerator.
Install
pip install sec-audit-logging
Emitting a record
External packages provide the final primitive logging attributes:
import logging
from sec_audit.logging import emit_log
emit_log(
logging.getLogger('sec_audit'),
'payment.checked',
{'event_type': 'payment.checked', 'schema_version': '1.0', 'payment_id': 'pay-1'},
logging.INFO,
)
Builders return new dicts (immutable); scrubbers return new dicts with sensitive values redacted.
Loki / Grafana stack generator
The bundled console script copies a ready-to-run monitoring stack (Grafana Alloy → Loki → Grafana) from the package's canonical templates:
sec-audit-loki-init monitoring \
--app-label myapp \
--environment prod \
--audit-log-path ../logs/sec-audit.jsonl
See the Loki setup guide for an end-to-end walkthrough.
License
MIT
Metadata
Release files for sec-audit-logging 0.1.0a2
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 |
|---|---|---|---|---|
| sec_audit_logging-0.1.0a2.tar.gz | 26.2 kB | Without provenance | Details for sec_audit_logging-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sec_audit_logging-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for sec_audit_logging-0.1.0a2-py3-none-any.whl |
Total release size: 53.4 kB
Release files / sec_audit_logging-0.1.0a2.tar.gz
| Download URL | sec_audit_logging-0.1.0a2.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f77b07b7bd98fc50559b4d5b3cd1b4f0ffd2cb39f47b0b6784e5084271b2702
|
|
BLAKE2b-256 checksum How to use checksums |
63d337fd5ed4a8d14d8c20f911d82442032849b078630fedb40b27c77716cd37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / sec_audit_logging-0.1.0a2-py3-none-any.whl
| Download URL | sec_audit_logging-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1b3d50552490012b6c30ccd2ac6ccf2122d1b93f6be083ea34bf87cb2b08a8a
|
|
BLAKE2b-256 checksum How to use checksums |
73f211b482aea619686d839f0bf64ac2be0bb822bb0e50e893a2e976cd9e3a3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for sec-audit-logging 0.1.0a2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.