summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-11-05 10:12:32 -0700
committerMatthew Heon <matthew.heon@pm.me>2021-11-12 11:08:25 -0500
commit93a3e720d794d8ae028075a20d92a4ab513d0051 (patch)
treeea6eaba1b1e67f43d8a19690d6405dadeb775814
parentb1ac02dcbbfd2a3f47955bf739fe03f83375a6c1 (diff)
downloadpodman-93a3e720d794d8ae028075a20d92a4ab513d0051.tar.gz
podman-93a3e720d794d8ae028075a20d92a4ab513d0051.tar.bz2
podman-93a3e720d794d8ae028075a20d92a4ab513d0051.zip
Log Apache access_log-like entries at Info level [NO NEW TESTS NEEDED]
Only log API access entries when --log-level set to Info or below. Fixes #12181 Signed-off-by: Jhon Honce <jhonce@redhat.com>
-rw-r--r--pkg/api/server/handler_rid.go9
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 == "" {