Skip to content

Commit

Permalink
cmd: Health endpoints now emit TRACE logs (#314)
Browse files Browse the repository at this point in the history
Remove health endpoints from the logs to make monitoring easier. Setting `log_level` to `trace` will show these calls.

Closes #283
  • Loading branch information
aeneasr authored Dec 17, 2019
1 parent 1519632 commit 9036f8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"net/http/httputil"
"sync"

negronilogrus "github.com/meatballhat/negroni-logrus"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/urfave/negroni"

"github.com/ory/x/reqlog"

"github.com/ory/viper"

"github.com/ory/x/healthx"
Expand All @@ -40,7 +41,7 @@ func runProxy(d driver.Driver, n *negroni.Negroni, logger *logrus.Logger) func()
Transport: proxy,
}

n.Use(negronilogrus.NewMiddlewareFromLogger(logger, "oathkeeper-proxy"))
n.Use(reqlog.NewMiddlewareFromLogger(logger, "oathkeeper-proxy").ExcludePaths(healthx.ReadyCheckPath, healthx.AliveCheckPath))
n.UseHandler(handler)

h := corsx.Initialize(n, logger, "serve.proxy")
Expand Down Expand Up @@ -78,7 +79,7 @@ func runAPI(d driver.Driver, n *negroni.Negroni, logger *logrus.Logger) func() {
d.Registry().HealthHandler().SetRoutes(router.Router, true)
d.Registry().CredentialHandler().SetRoutes(router)

n.Use(negronilogrus.NewMiddlewareFromLogger(logger, "oathkeeper-api"))
n.Use(reqlog.NewMiddlewareFromLogger(logger, "oathkeeper-api").ExcludePaths(healthx.ReadyCheckPath, healthx.AliveCheckPath))
n.Use(d.Registry().DecisionHandler()) // This needs to be the last entry, otherwise the judge API won't work

n.UseHandler(router)
Expand Down

0 comments on commit 9036f8e

Please sign in to comment.