From a31e532b560ca51daf162abdffbcfaac74c25942 Mon Sep 17 00:00:00 2001 From: jarppiko <23549925+jarppiko@users.noreply.github.com> Date: Wed, 7 Jun 2023 14:02:15 +0300 Subject: [PATCH] Remove hard-coded 0600 log file perms (#294) --- pkg/cfg/logging.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/cfg/logging.go b/pkg/cfg/logging.go index bbf99b7c..604598d1 100644 --- a/pkg/cfg/logging.go +++ b/pkg/cfg/logging.go @@ -4,12 +4,11 @@ import ( "fmt" "io" "os" + "path/filepath" log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/writer" "gopkg.in/natefinch/lumberjack.v2" - - "github.com/crowdsecurity/go-cs-lib/pkg/logtools" ) type LoggingConfig struct { @@ -27,10 +26,8 @@ func (c *LoggingConfig) LoggerForFile(fileName string) (io.Writer, error) { return os.Stderr, nil } - logPath, err := logtools.SetLogFilePermissions(c.LogDir, fileName) - if err != nil { - return nil, err - } + // rely on lumberjack to create log file during first write + logPath := filepath.Join(c.LogDir, fileName) l := &lumberjack.Logger{ Filename: logPath,