From 3b31b7ce83585c3d505fcb0dee0840c42f17e21c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 29 May 2021 19:07:54 +0200 Subject: [PATCH] core: add http host in log messages Signed-off-by: Jens Langhammer --- authentik/core/middleware.py | 7 ++++++- web/src/pages/tenants/TenantForm.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/authentik/core/middleware.py b/authentik/core/middleware.py index 1f09555b7..64400b64b 100644 --- a/authentik/core/middleware.py +++ b/authentik/core/middleware.py @@ -42,10 +42,14 @@ class RequestIDMiddleware: if not hasattr(request, "request_id"): request_id = uuid4().hex setattr(request, "request_id", request_id) - LOCAL.authentik = {"request_id": request_id} + LOCAL.authentik = { + "request_id": request_id, + "host": request.get_host(), + } response = self.get_response(request) response[RESPONSE_HEADER_ID] = request.request_id del LOCAL.authentik["request_id"] + del LOCAL.authentik["host"] return response @@ -54,4 +58,5 @@ def structlog_add_request_id(logger: Logger, method_name: str, event_dict): """If threadlocal has authentik defined, add request_id to log""" if hasattr(LOCAL, "authentik"): event_dict["request_id"] = LOCAL.authentik.get("request_id", "") + event_dict["host"] = LOCAL.authentik.get("host", "") return event_dict diff --git a/web/src/pages/tenants/TenantForm.ts b/web/src/pages/tenants/TenantForm.ts index b0c78c780..b90513044 100644 --- a/web/src/pages/tenants/TenantForm.ts +++ b/web/src/pages/tenants/TenantForm.ts @@ -43,10 +43,10 @@ export class TenantForm extends ModelForm { + name="domain"> - +