From c81a001011b325b7831fa4c535d551bdaf4946f4 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 10 Jul 2023 11:36:28 +0200 Subject: [PATCH] make --syslog errors non fatal Podman will always pass down --syslog to conmon since 13c2aca21. However there systems without syslog running, likely in container setups. As reported in this was already a problem before when debug level is used. Then conmon will pass down --syslog back to the podman container cleanup command causing it to fail without doing anything. Given that I think it is better to just ignore the error and log it on debug level, we need to make sure cleanup works consistently. [NO NEW TESTS NEEDED] Fixes #19075 Signed-off-by: Paul Holzinger --- cmd/podman/syslog_common.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd/podman/syslog_common.go b/cmd/podman/syslog_common.go index e035e63652..b9909f8ec0 100644 --- a/cmd/podman/syslog_common.go +++ b/cmd/podman/syslog_common.go @@ -4,9 +4,7 @@ package main import ( - "fmt" "log/syslog" - "os" "github.com/sirupsen/logrus" logrusSyslog "github.com/sirupsen/logrus/hooks/syslog" @@ -19,10 +17,8 @@ func syslogHook() { hook, err := logrusSyslog.NewSyslogHook("", "", syslog.LOG_INFO, "") if err != nil { - fmt.Fprint(os.Stderr, "Failed to initialize syslog hook: "+err.Error()) - os.Exit(1) - } - if err == nil { + logrus.Debug("Failed to initialize syslog hook: " + err.Error()) + } else { logrus.AddHook(hook) } }