Skip to main content

Simple audit logging for Django requests

Project description

This package adds simple audit logging to a Django project.

A log is generated at info level each time a request is made. The log includes the following information:

  • A UTC timestamp

  • Request method (HTTP verb)

  • Full URL

  • IP address

  • A value from a custom user field (see below)

  • The requesting user’s email address

  • The requesting user’s first name

  • The requesting user’s last name

Installation

pip install django-audit-log-middleware

Usage

Using in a Django middleware configuration:

INSTALLED_APPS = [
    ...
    "django_audit_log_middleware",
]

MIDDLEWARE = [
    ...
    "django_audit_log_middleware.AuditLogMiddleware",
]

Dependencies

This project is a Django app and depends on the Django package.

This package uses Django IPware https://github.com/un33k/django-ipware for IP address capture.

Settings

AUDIT_LOG_USER_FIELD

Provide to define a field on your user model that should be captured in the audit log. Email, first name and last name are captured by default.

Tests

$ pip install -r requirements.txt
$ tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_audit_log_middleware-0.0.6.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_audit_log_middleware-0.0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file django_audit_log_middleware-0.0.6.tar.gz.

File metadata

File hashes

Hashes for django_audit_log_middleware-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7badca9b12d53a1b35ff4b0fc8a16e6a21482a6ceb60a9fcbf64cd1b7f8a6c86
MD5 af80922f90c9c3c47dda8802c2585a16
BLAKE2b-256 ee1043082e379657b802b35b0de727f4927c9642df94ed964458c80248d559e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_audit_log_middleware-0.0.6.tar.gz:

Publisher: publish.yml on uktrade/django-audit-log-middleware

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_audit_log_middleware-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for django_audit_log_middleware-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4c646cc5014b621ba0195d8e49efb008fd1ef9c8d0003e358f64e06d6829fa56
MD5 65b43afb58149a7b2264597e4559e1de
BLAKE2b-256 da1c4edd53419b8e7f2448881e2f412e43ab6e0901b320a7c90665a6e8da9207

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_audit_log_middleware-0.0.6-py3-none-any.whl:

Publisher: publish.yml on uktrade/django-audit-log-middleware

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page