Add access-log

This commit is contained in:
Ilja Neumann
2020-11-18 14:38:16 +01:00
committed by Phil Davis
parent fe8586643f
commit c2aa4b02de
2 changed files with 14 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
Enhancement: Create a proxy acess-log
Logs client access at the proxy
https://github.com/owncloud/ocis/pull/889

View File

@@ -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
}