Disable email for bad request in django but still log to file

Viewed 23

Someone recently tried to hack our Django server. They sent a lot of bad requests which triggered a lot of emails. How can we disable the emails but still log the bad requests? We have this the block below for DisallowedHosts so I expect something similar for bad requests.

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'null': {
            'class': 'logging.NullHandler',
        },
    },
    'loggers': {
        "django.security.DisallowedHost": {
            "handlers": ["null"],
            "propagate": False,
        },
    },
}
0 Answers
Related