From 0d0a97cc1bd7c4ba6a09211c4047f1b812e3e5c0 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Wed, 14 Apr 2021 16:14:36 -0700 Subject: [PATCH] Mute the disallowed host logger in prod --- config/settings/base.py | 3 +++ config/settings/production.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/config/settings/base.py b/config/settings/base.py index 69184dc0..dc1e1863 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -231,6 +231,9 @@ "class": "logging.StreamHandler", "formatter": "succinct", }, + "null": { + "class": "logging.NullHandler", + }, }, "loggers": { "": {"level": "INFO", "handlers": ["console"], "propagate": False}, diff --git a/config/settings/production.py b/config/settings/production.py index 5d7c18e6..e82d1270 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -43,6 +43,15 @@ DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=3600) +# Logging changes +# -------------------------------------------------------------------------- +# Folks spam our site with random hosts all the time. Ignore these errors. +LOGGING["loggers"]["django.security.DisallowedHost"] = { + "handlers": ["null"], + "propagate": False, +} + + # Cache # https://docs.djangoproject.com/en/2.2/topics/cache/ # https://niwinz.github.io/django-redis/