--- id: django-log-formatter-asim version: "1.3.1" license: MIT license_treatment: permissive maintenance: active --- # django-log-formatter-asim — Formats Django logs in ASIM format. License: permissive · Maintenance: active · Downloads: 108.1K/mo ## 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 above — 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 pip install django-log-formatter-asim uv add django-log-formatter-asim 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_current - Install friction: low - Maintenance: active - Downloads: 108.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django asim log formatter, azure sentinel log normalization, django structured logging json, asim event schema django, security log formatting, security-logging, azure-sentinel, django-middleware [View on SkillFed](https://skillfed.io/packages/django-log-formatter-asim) · [View on PyPI](https://pypi.org/project/django-log-formatter-asim/)