From be26b92927cb800e239bc7cb25a2098d83664a74 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 21 May 2022 13:18:06 +0200 Subject: [PATCH] internal: cleanup outpost logs Signed-off-by: Jens Langhammer --- internal/outpost/ak/global.go | 12 ++++++++++-- internal/outpost/proxyv2/application/session.go | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 67d822a46..10bd9cca9 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -13,6 +13,8 @@ import ( "goauthentik.io/internal/constants" ) +var initialSetup = false + func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { l := log.WithField("logger", "authentik.outpost") m := outpost.Managed.Get() @@ -38,11 +40,12 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { } else { l.Debug("Managed outpost, not setting global log level") } - l.WithField("hash", constants.BUILD("tagged")).WithField("version", constants.VERSION).Info("Starting authentik outpost") if globalConfig.ErrorReporting.Enabled { dsn := "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8" - l.WithField("env", globalConfig.ErrorReporting.Environment).Debug("Error reporting enabled") + if !initialSetup { + l.WithField("env", globalConfig.ErrorReporting.Environment).Debug("Error reporting enabled") + } err := sentry.Init(sentry.ClientOptions{ Dsn: dsn, Environment: globalConfig.ErrorReporting.Environment, @@ -56,6 +59,11 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { l.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry") } } + + if !initialSetup { + l.WithField("hash", constants.BUILD("tagged")).WithField("version", constants.VERSION).Info("Starting authentik outpost") + initialSetup = true + } } // GetTLSTransport Get a TLS transport instance, that skips verification if configured via environment variables. diff --git a/internal/outpost/proxyv2/application/session.go b/internal/outpost/proxyv2/application/session.go index f65800394..94b8d641d 100644 --- a/internal/outpost/proxyv2/application/session.go +++ b/internal/outpost/proxyv2/application/session.go @@ -30,7 +30,7 @@ func (a *Application) getStore(p api.ProxyOutpostConfig, externalHost *url.URL) } rs.Options.Path = externalHost.Path rs.Options.Domain = *p.CookieDomain - a.log.Debug("using redis session backend") + a.log.Trace("using redis session backend") store = rs } else { dir := os.TempDir() @@ -51,7 +51,7 @@ func (a *Application) getStore(p api.ProxyOutpostConfig, externalHost *url.URL) } cs.Options.Path = externalHost.Path cs.Options.Domain = *p.CookieDomain - a.log.WithField("dir", dir).Debug("using filesystem session backend") + a.log.WithField("dir", dir).Trace("using filesystem session backend") store = cs } return store