Per-model audit logs to TABLENAME_log with entry-point capture (HTTP/management/shell/celery)
Project description
Awesome Audit Log for Django
This is an awesome package to have your models logs in corresponding _log tables.
Having a single model/table as audit storage can cause heavy db operation and useless for large applications.
With this package you will have each model log in a separate table which can be beneficial if you want to truncate a specific model logs or run a query on them.
You can choose between having logs table in your default database or adding a new backend db as logs db.
Supported DBs to store logs:
- PostgreSQL
- MySQL
- SQLite
This package is in its early stage development and the following features will be added ASAP:
- Utilizing celery tasks to store audit logs
- Release it!
- Log rotation
- Mongo DB support
- Add management, shell, celery as entry point of logs
- Document page!
Compatible With
This package works on the below listed Django, Python versions and Databases.
- Django versions: 4.2, 5.0, 5.1
- Python versions: 3.10, 3.11, 3.12
- Databases: SQLite, PostgreSQL, MySQL
Installation
- Add App
INSTALLED_APPS = [
# ...
'awesome_audit_log.apps.AwesomeAuditLogConfig',
]
- Add Middleware
MIDDLEWARE = [
# ...
"awesome_audit_log.middleware.RequestEntryPointMiddleware",
]
- Settings
AWESOME_AUDIT_LOG = {
"ENABLED": True,
"DATABASE_ALIAS": "default",
# PostgreSQL schema for audit tables (defaults to 'public')
"PG_SCHEMA": None,
"ASYNC": False,
# "all" or list like ["app_label.ModelA", "app.ModelB"]
"AUDIT_MODELS": "all",
# like AUDIT_MODELS but for opt-out, useful when AUDIT_MODELS set to all
"NOT_AUDIT_MODELS": None,
"CAPTURE_HTTP": True,
# set to False means if audit db is unavailable, silently skip logging (with a warning) instead of raising
"RAISE_ERROR_IF_DB_UNAVAILABLE": False,
# if audit alias missing/unavailable, use 'default' intentionally, this requires RAISE_ERROR_IF_DB_UNAVAILABLE is set to False
"FALLBACK_TO_DEFAULT": False,
}
Development
Preparation
# Install dependencies
poetry install
Running Tests and Linter Locally
# Run tests
poetry run pytest
# Run linting
poetry run ruff check awesome_audit_log tests
poetry run ruff format --check awesome_audit_log tests
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awesome_audit_log_django-0.2.0.tar.gz.
File metadata
- Download URL: awesome_audit_log_django-0.2.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac37e59f694720f59f43700afabdbae6135f7877a372383dc299ba4cbe38fda5
|
|
| MD5 |
ffe7a252577a762d77c10c0205cdb8ea
|
|
| BLAKE2b-256 |
7daaa4d10cb17dc023799ce7ee5a829885bd993c2c7e636b201ef84025905d95
|
File details
Details for the file awesome_audit_log_django-0.2.0-py3-none-any.whl.
File metadata
- Download URL: awesome_audit_log_django-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a11ae9155aef335d74495b2f209481b6c03cf8861150714ff3b91cdabcafa0c1
|
|
| MD5 |
0579c6d9d8d867f8a8358fe60b5fe3da
|
|
| BLAKE2b-256 |
1f00dfef953af8c89b1610677e32f9a8ad088cdd7a26e706ae0fbf5d47362733
|