diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-05 20:53:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 20:53:54 +0100 |
commit | 6c0690dbab9de2f41365cca4cf1ed74514db7f52 (patch) | |
tree | f80711c36195fdbaaccd5efc1072a1f044b2977f /pkg/api | |
parent | b2f4cdfbaf20026c3e7d1bcec271d3a2724f1e6d (diff) | |
parent | 5c0351cc6f1b532cbdd1602736ad3ddac99fec01 (diff) | |
download | podman-6c0690dbab9de2f41365cca4cf1ed74514db7f52.tar.gz podman-6c0690dbab9de2f41365cca4cf1ed74514db7f52.tar.bz2 podman-6c0690dbab9de2f41365cca4cf1ed74514db7f52.zip |
Merge pull request #12186 from jwhonce/issues/12181
Log Apache access_log-like entries at Info level
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/server/handler_rid.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/api/server/handler_rid.go b/pkg/api/server/handler_rid.go index b624b99a6..7dcf436f7 100644 --- a/pkg/api/server/handler_rid.go +++ b/pkg/api/server/handler_rid.go @@ -2,6 +2,7 @@ package server import ( "fmt" + "io/ioutil" "net/http" "github.com/containers/podman/v3/pkg/api/types" @@ -15,7 +16,13 @@ import ( // and Apache style request logging func referenceIDHandler() mux.MiddlewareFunc { return func(h http.Handler) http.Handler { - return handlers.CombinedLoggingHandler(logrus.StandardLogger().Out, + // Only log Apache access_log-like entries at Info level or below + out := ioutil.Discard + if logrus.IsLevelEnabled(logrus.InfoLevel) { + out = logrus.StandardLogger().Out + } + + return handlers.CombinedLoggingHandler(out, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { rid := r.Header.Get("X-Reference-Id") if rid == "" { |