From 698adbd64ef2c4ebc8f497dbd9bb36273507be98 Mon Sep 17 00:00:00 2001 From: Ilja Neumann Date: Wed, 18 Nov 2020 14:38:16 +0100 Subject: [PATCH] Add access-log --- proxy/pkg/proxy/proxy.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/proxy/pkg/proxy/proxy.go b/proxy/pkg/proxy/proxy.go index 5850c30ab99..ce8c4d87a05 100644 --- a/proxy/pkg/proxy/proxy.go +++ b/proxy/pkg/proxy/proxy.go @@ -117,13 +117,20 @@ func (p *MultiHostReverseProxy) directorSelectionDirector(r *http.Request) { } for endpoint := range p.Directors[pol][rt] { if handler(endpoint, *r.URL) { - p.logger. - Debug(). + + p.logger.Debug(). Str("policy", pol). Str("prefix", endpoint). Str("path", r.URL.Path). Str("routeType", string(rt)). Msg("director found") + + p.logger. + Info().Fields(map[string]interface{}{ + "method": r.Method, + "path": r.URL.Path, + "from": r.RemoteAddr, + }).Msg("access-log") p.Directors[pol][rt][endpoint](r) return }