Skip to content

Commit

Permalink
Merge pull request #12186 from jwhonce/issues/12181
Browse files Browse the repository at this point in the history
Log Apache access_log-like entries at Info level
  • Loading branch information
openshift-merge-robot authored Nov 5, 2021
2 parents b2f4cdf + 5c0351c commit 6c0690d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/api/server/handler_rid.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package server

import (
"fmt"
"io/ioutil"
"net/http"

"github.com/containers/podman/v3/pkg/api/types"
Expand All @@ -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 == "" {
Expand Down

0 comments on commit 6c0690d

Please sign in to comment.