From a6bb2cf5e1a8569906c9209f73c9a806f4ac4e68 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Wed, 1 Mar 2023 17:00:04 +0100 Subject: [PATCH] Fix log destination in one-shot mode (#2084) --- .github/buildkit.toml | 2 +- cmd/crowdsec/main.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/buildkit.toml b/.github/buildkit.toml index 7de2f5cd5..879e31fdf 100644 --- a/.github/buildkit.toml +++ b/.github/buildkit.toml @@ -1,2 +1,2 @@ [worker.oci] - max-parallelism = 2 +# max-parallelism = 2 diff --git a/cmd/crowdsec/main.go b/cmd/crowdsec/main.go index 67f0f9967..d7894012b 100644 --- a/cmd/crowdsec/main.go +++ b/cmd/crowdsec/main.go @@ -211,6 +211,11 @@ func LoadConfig(cConfig *csconfig.Config) error { return err } + if flags.SingleFileType != "" && flags.OneShotDSN != "" { + // if we're in time-machine mode, we don't want to log to file + cConfig.Common.LogMedia = "stdout" + } + // Configure logging if err := types.SetDefaultLoggerConfig(cConfig.Common.LogMedia, cConfig.Common.LogDir, *cConfig.Common.LogLevel, @@ -264,7 +269,6 @@ func LoadConfig(cConfig *csconfig.Config) error { if flags.DisableAPI { cConfig.Common.Daemonize = false } - cConfig.Common.LogMedia = "stdout" log.Infof("single file mode : log_media=%s daemonize=%t", cConfig.Common.LogMedia, cConfig.Common.Daemonize) }