From c2aa4b02dec6ccd2ff2205b98fb81a3a69ebd1ed Mon Sep 17 00:00:00 2001 From: Ilja Neumann Date: Wed, 18 Nov 2020 14:38:16 +0100 Subject: [PATCH 1/2] Add access-log --- changelog/unreleased/proxy-access-log.md | 5 +++++ proxy/pkg/proxy/proxy.go | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/proxy-access-log.md diff --git a/changelog/unreleased/proxy-access-log.md b/changelog/unreleased/proxy-access-log.md new file mode 100644 index 00000000000..026ebfb2df4 --- /dev/null +++ b/changelog/unreleased/proxy-access-log.md @@ -0,0 +1,5 @@ +Enhancement: Create a proxy acess-log + +Logs client access at the proxy + +https://github.com/owncloud/ocis/pull/889 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 } From 5196a2edcdda800cd1d904220a0559e2d54b0212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 18 Nov 2020 19:34:19 +0100 Subject: [PATCH 2/2] Update changelog/unreleased/proxy-access-log.md Co-authored-by: Phil Davis --- changelog/unreleased/proxy-access-log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/unreleased/proxy-access-log.md b/changelog/unreleased/proxy-access-log.md index 026ebfb2df4..a1ddb951b87 100644 --- a/changelog/unreleased/proxy-access-log.md +++ b/changelog/unreleased/proxy-access-log.md @@ -1,4 +1,4 @@ -Enhancement: Create a proxy acess-log +Enhancement: Create a proxy access-log Logs client access at the proxy