Skip to content

Commit

Permalink
Merge pull request #889 from owncloud/add-access-log
Browse files Browse the repository at this point in the history
Add access-log
  • Loading branch information
phil-davis authored Nov 19, 2020
2 parents fe85866 + 5196a2e commit b4b4574
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/proxy-access-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Create a proxy access-log

Logs client access at the proxy

https://github.com/owncloud/ocis/pull/889
11 changes: 9 additions & 2 deletions proxy/pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit b4b4574

Please sign in to comment.