django-log-formatter-asim
Formats Django logs in ASIM format.
What it is and what it does
This package provides a Django logging formatter that converts application logs into Azure Sentinel's ASIM schema—a standardized format for security event normalization. It includes a base ASIMFormatter class that routes logs through specialized serializers: a generic ASIMRootFormatter for standard logs and a custom ASIMRequestFormatter for django.request logs (4xx/5xx responses). The package also exposes an events module with functions like log_authentication and log_file_activity that generate ASIM-compliant event entries directly from Django HttpRequest objects.
The formatter outputs structured JSON with ASIM fields (EventSchema, EventType, EventResult, SrcIpAddr, etc.) plus optional DataDog trace fields when available. Configuration is handled through Django settings: DLFA_LOG_PERSONALLY_IDENTIFIABLE_INFORMATION controls PII inclusion, DLFA_TRACE_HEADERS customizes trace header names for different hosting environments (AWS, GOV.UK PaaS), and DLFA_INCLUDE_RAW_LOG optionally embeds the original unformatted log (with a security warning). You can extend the formatter by subclassing ASIMRootFormatter and registering custom serializers for specific loggers.
Use it for:
- Send Django application logs to Azure Sentinel for centralized security monitoring and threat detection.
- Generate standardized authentication event logs (login/logoff) that comply with ASIM schema for compliance audits.
- Track file operations (copy, move, rename) with ASIM FileEvent schema for data access and integrity monitoring.
- Integrate with DataDog APM by automatically including trace IDs and span IDs in ASIM-formatted logs.
- Normalize logs from Django apps deployed across different cloud platforms (AWS, GOV.UK PaaS) using environment-specific trace headers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formats Django application logs in Azure Sentinel's ASIM (Advanced Security Information Model) schema, converting standard Django logging output to structured JSON that conforms to Microsoft's normalization format.
Yes, if you need to send Django logs to Azure Sentinel or require ASIM-compliant structured logging for security compliance. Low install friction, no known vulnerabilities, and active maintenance make it a safe choice. Not necessary if you use a different SIEM or have no requirement for ASIM normalization.
Install
django-log-formatter-asim on PyPI
pip
pip install django-log-formatter-asimuv
uv add django-log-formatter-asimpoetry
poetry add django-log-formatter-asimInstalling django-log-formatter-asim
Before you install
Low install friction with a pure Python wheel. Actively maintained as of 23 days ago. Depends on django, ddtrace, and django-ipware, all standard packages with straightforward installation.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects, with only attribution required.
Quickstart
pip install django-log-formatter-asim
from django_log_formatter_asim import ASIMFormatter
LOGGING = {
"formatters": {
"asim_formatter": {"()": ASIMFormatter},
},
"handlers": {
"asim": {"formatter": "asim_formatter"},
},
"root": {"handlers": ["asim"]},
}
Requires Python 3.10 or later (supports up to 3.14); django and ddtrace must be installed.
Verify before relying
- Whether ASIM field mapping coverage is sufficient for your specific security event types beyond authentication and file activity.
- Performance impact of JSON serialization on high-volume logging scenarios.
- Compatibility with custom Django logging handlers or third-party log aggregation services.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — ddtrace, django, django-ipware |
| Maintenance | actively maintained — 23 days since the last release |
| First released | |
| Downloads | 108,098/month — #12,579 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_log_formatter_asim-1.3.1-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
django-datadog-loggerIntegrates Django applications with Datadog…
permissive · top 15,000 on PyPI
logging-azure-restProvides a Python logging handler that…
permissive · top 5,000 on PyPI
mo-logsProvides structured JSON logging with…
copyleft · top 15,000 on PyPI
django-request-loggingA Django middleware that logs HTTP request and…
permissive · top 15,000 on PyPI
python-json-loggerFormats Python logging output as JSON, making…
permissive · top 1,000 on PyPI
logfmterFormats Python stdlib logging output as logfmt…
permissive · top 15,000 on PyPI
JSON-log-formatterFormats Python logging records as JSON,…
permissive · top 5,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI
django-ipwareRetrieves the client's IP address from a Django…
permissive · top 5,000 on PyPI
jsonformatterFormats Python logging output as JSON, enabling…
permissive · top 15,000 on PyPI