Audit Logging
Audit logging refers to the practice of writing logs for each action carried in a system—be it a web application, a REST API, or a database—as a way to record “who did what” at a particular point in time.
Out of the box, Django already provides some minimal form of audit logging in the admin. Also, the user table in Django records the last login of each user in the system.
But these two trails are far from being a full-fledged audit logging solution and do not cover the REST API. There are a couple of packages for Django to add audit logging capabilities:
Note
- django-simple-history
- django-auditlog
django-simple-history
can track changes on models. This capability, paired with access logging, can provide effective audit logging for Django projects. django-simple-history
is a mature package, actively supported.
On the other hand, django-auditlog
provides the same functionalities, but it is still in development at the time of this writing.
Install
Reference
Book