skillfed

django-log-formatter-asim

Formats Django logs in ASIM format.

django-log-formatter-asim v1.3.1 108.1K downloads/30d#12,579 on PyPI
Permissive license MIT Active released

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-asim

uv

uv add django-log-formatter-asim

poetry

poetry add django-log-formatter-asim

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

django asim log formatterazure sentinel log normalizationdjango structured logging jsonasim event schema djangosecurity log formatting
security-loggingazure-sentineldjango-middleware

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

django-datadog-logger

Integrates Django applications with Datadog…

permissive · top 15,000 on PyPI

logging-azure-rest

Provides a Python logging handler that…

permissive · top 5,000 on PyPI

mo-logs

Provides structured JSON logging with…

copyleft · top 15,000 on PyPI

django-request-logging

A Django middleware that logs HTTP request and…

permissive · top 15,000 on PyPI

python-json-logger

Formats Python logging output as JSON, making…

permissive · top 1,000 on PyPI

logfmter

Formats Python stdlib logging output as logfmt…

permissive · top 15,000 on PyPI

JSON-log-formatter

Formats Python logging records as JSON,…

permissive · top 5,000 on PyPI

cloudwatch

A Python logging handler that sends log events…

permissive · top 15,000 on PyPI

django-ipware

Retrieves the client's IP address from a Django…

permissive · top 5,000 on PyPI

jsonformatter

Formats Python logging output as JSON, enabling…

permissive · top 15,000 on PyPI