From 98cfd38ad5c126cdbbd688c99667720c104ca352 Mon Sep 17 00:00:00 2001 From: Giuseppe Lo Presti Date: Fri, 23 Jun 2023 14:23:10 +0200 Subject: [PATCH] Split (potentially sensitive) details to a trace-level log --- internal/http/interceptors/log/log.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/http/interceptors/log/log.go b/internal/http/interceptors/log/log.go index 1b22d5c6d89..32ac40d1379 100644 --- a/internal/http/interceptors/log/log.go +++ b/internal/http/interceptors/log/log.go @@ -97,8 +97,10 @@ func writeLog(log *zerolog.Logger, req *http.Request, url url.URL, ts time.Time, default: event = log.Error() } + event.Str("host", host).Str("method", req.Method).Str("uri", uri).Int("status", status). + Msg("processed http request") - event.Str("host", host).Str("method", req.Method). + log.Trace().Str("host", host).Str("method", req.Method). Str("uri", uri).Str("proto", req.Proto).Interface("req_headers", req.Header). Int("status", status).Int("size", size).Interface("res_headers", resHeaders). Str("start", ts.Format("02/Jan/2006:15:04:05 -0700")).