internal: cleanup outpost logs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-05-21 13:18:06 +02:00
parent dd3ed1bfb9
commit be26b92927
2 changed files with 12 additions and 4 deletions

View File

@ -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"
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.

View File

@ -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