5 Sep
2024
5 Sep
'24
4:11 p.m.
Ok, after some trial and error, I was able to resolve the issue. Here's what I did in case someone else encounters this issue. Updated logging as follows:
created function:
def skip_scanner(record): """Returns Boolean value for filter to distinguish between real and scanner requests""" scanner = ("<scanner IPs>") record.ip = record.request.META.get('HTTP_X_FORWARDED_FOR') # ip if record.ip in scanner: return False # the request does not require an email as it is from my scanners else: return True # the request DOES require an email as it is NOT from my scanners
Addition to the filters section:
'skip_scanner': {
'()': 'django.utils.log.CallbackFilter',
'callback': skip_scanner
}
Update to the 'mail_admins' in the 'handlers' section:
'filters': ['require_debug_false','skip_scanner'],