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
Built Distribution
Hashes for django_audit_log_middleware-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8648209ab2976e3d0a6708be28a1650e7c316a1cfa9fdf209bbc766771666bbd |
|
MD5 | 9da12bc13372801de8db878dab68bc9b |
|
BLAKE2b-256 | fdb4db524fb8d74037dfac0041bf43e9741a3ef305716a686a65990b6d4ce9e5 |
Hashes for django_audit_log_middleware-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9783da2891b75233684eecc1fe548960f48fbae1faecf5e7422cd9451f8a21 |
|
MD5 | bba706b1c67c8bb5c3df6bcfc16381c9 |
|
BLAKE2b-256 | 7e98ed1ea088d7e04aabadf5730870e31b75055120047fe6564a6850c0b25097 |