From 74169860cf4f79460274cd309f72b9be9b1fba5b Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 23 Sep 2021 09:57:42 +0200 Subject: [PATCH] api: add logging to sentry proxy Signed-off-by: Jens Langhammer --- authentik/api/v3/sentry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/authentik/api/v3/sentry.py b/authentik/api/v3/sentry.py index caa7c3b85..273c3e80c 100644 --- a/authentik/api/v3/sentry.py +++ b/authentik/api/v3/sentry.py @@ -10,10 +10,13 @@ from rest_framework.permissions import AllowAny from rest_framework.request import Request from rest_framework.throttling import AnonRateThrottle from rest_framework.views import APIView +from structlog.stdlib import get_logger from authentik.api.tasks import sentry_proxy from authentik.lib.config import CONFIG +LOGGER = get_logger() + class PlainTextParser(BaseParser): """Plain text parser.""" @@ -45,6 +48,7 @@ class SentryTunnelView(APIView): """Sentry tunnel, to prevent ad blockers from blocking sentry""" # Only allow usage of this endpoint when error reporting is enabled if not CONFIG.y_bool("error_reporting.enabled", False): + LOGGER.debug("error reporting disabled") return HttpResponse(status=400) # Body is 2 json objects separated by \n full_body = request.body @@ -55,6 +59,7 @@ class SentryTunnelView(APIView): # Check that the DSN is what we expect dsn = header.get("dsn", "") if dsn != settings.SENTRY_DSN: + LOGGER.debug("Invalid dsn", have=dsn, expected=settings.SENTRY_DSN) return HttpResponse(status=400) sentry_proxy.delay(full_body.decode()) return HttpResponse(status=204)