From 4ab320c746ae871cb20d1650975de5424c8ff57d Mon Sep 17 00:00:00 2001 From: Allex Veldman Date: Thu, 17 Oct 2024 15:22:42 +0200 Subject: [PATCH] feat(log): Include host is logs Includes the `Forwarded`, `X-Forwarded-Host`, or `Host` header in the logs --- src/app.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app.rs b/src/app.rs index 1c19351..ba77c65 100644 --- a/src/app.rs +++ b/src/app.rs @@ -65,6 +65,7 @@ pub fn router() -> Router { /// Log incoming requests async fn accesslog_middleware( method: axum::http::Method, + host: Option, uri: axum::http::Uri, headers: axum::http::HeaderMap, request: axum::extract::Request, @@ -78,6 +79,7 @@ async fn accesslog_middleware( .map(|ua| ua.to_str().unwrap_or("")); tracing::info!( method = method.to_string(), + host = host.map(|value| value.0), status, path = uri.path(), user_agent,