A logger to be used internally
Project description
Django Audit Logger
Install
Pip
pip install auditlogger
Dependencies:
- Django
- Boto3
- Celery
- Redis
Settings
Add the following settings to your settings.py file.
AUDIT_LOG_REGION = ''
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AUDIT_LOG_GROUP_NAME = ''
AUDIT_LOG_STREAM_NAME = ''
AUDIT_LOG_EXCLUDE = ['']
# Interval value represents minutes
LOG_INTERVAL = '' (default = 5)
Add auditlogger to your INSTALLED_APPS.
Log models
The User model is logged by default, you can select additional models by using the @auditlogger_update_delete decorator.
@auditlogger_update_delete
class ModelToLog(models.Model):
name = models.CharField(max_length=100)
(...)
Custom log events
You can also link other signals used in your app to the logger like so:
from auditlogger.signals import send_log
from django.dispatch import receiver, Signal
from myapp.models import Organisation
organisation_login_signal = Signal(providing_args=['date', 'instance'])
@receiver(organisation_login_signal, sender=Organisation)
def organisation_login(**kwargs):
"""detect organisation logins"""
send_log('ORGANISATION_LOGIN', **kwargs)
Exclude models
AUDIT_LOG_EXCLUDE = ['Session']
Test
The app comes with included tests that you can run with the following command.
python manage.py test auditlogger
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 django-audit-logger-1.0.0.tar.gz.
File metadata
- Download URL: django-audit-logger-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49d55f872970789caa92feede82644aed9077da80f14fd81c1420ee1e5fefcaf
|
|
| MD5 |
b249340eefc64d09a17bfb11d6a25661
|
|
| BLAKE2b-256 |
b290859b072df36c4ab5e77844b1f30cf414224de1d36f56b881347e7e375ce6
|
File details
Details for the file django_audit_logger-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_audit_logger-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0474767ebf8dde694e71fa5abcc23570df75103e7ae572709f12cf8b8bcf1d69
|
|
| MD5 |
b5079fc81242cca23211161e5eec7277
|
|
| BLAKE2b-256 |
de9c46eb44f67cb4085819e4bc75fc0ea719c78fd31e402ac682307cb356940a
|