django-auditlog
django-auditlog copied to clipboard
Possibility to disable logging remote IP address
django-auditlog
stores remote IP address to remote_addr
field of LogEntry
. However, IP address can be considered personal data, at least according to GDPR. An application that I'm developing uses django-auditlog
to log data changes (who did what and when), but user IP address is not essential information, and therefore should not be stored.
Also, it's not very visible that audit log stores remote IP address at all. It's not visible in admin view for example.
Is there a way to disable storing remote address?
No, there is no way right now.
You can create a custom middleware inherited from AuditlogMiddleware
and disable remote IP address and use it:
from auditlog.middleware import AuditlogMiddleware
class AuditlogMiddlewareWithoutIP(AuditlogMiddleware):
@staticmethod
def _get_remote_addr(request):
return None
Also, we can add a config flag to disable this behavior by configuration
Thank you for a quick reply. I have to go with custom middleware for now. But a config flag would be very appreciated in future versions. :+1:
I have created a PR for this purpose : #620
Thanks @Nathan-Cohen for fixing this