From 35fa6eb5722bc6c8ca72bbf5e17fa1643cf4b4dd Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Tue, 2 Aug 2022 18:10:30 -0400 Subject: [PATCH] Ignore DisallowedHosts logs from Sentry (#842) --- api/catalog/settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/catalog/settings.py b/api/catalog/settings.py index 72edb602a..3af838aca 100644 --- a/api/catalog/settings.py +++ b/api/catalog/settings.py @@ -16,6 +16,7 @@ import sentry_sdk from decouple import config from sentry_sdk.integrations.django import DjangoIntegration +from sentry_sdk.integrations.logging import ignore_logger from catalog.configuration.aws import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY from catalog.configuration.elasticsearch import ES, MEDIA_INDEX_MAPPING @@ -350,3 +351,9 @@ send_default_pii=False, environment=ENVIRONMENT, ) + + # ALLOW_HOSTS is correctly configured so ignore this to prevent + # spammy bots like https://github.com/robertdavidgraham/masscan + # from pushing un-actionable alerts to Sentry like + # https://sentry.io/share/issue/9af3cdf8ef74420aa7bbb6697760a82c/ + ignore_logger("django.security.DisallowedHost")