Skip to content

Commit

Permalink
make --syslog errors non fatal
Browse files Browse the repository at this point in the history
Podman will always pass down --syslog to conmon since 13c2aca.
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 containers#19075

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Jul 10, 2023
1 parent b713fe3 commit 3f8ee70
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/podman/syslog_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
package main

import (
"fmt"
"log/syslog"
"os"

"github.com/sirupsen/logrus"
logrusSyslog "github.com/sirupsen/logrus/hooks/syslog"
Expand All @@ -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)
}
}

0 comments on commit 3f8ee70

Please sign in to comment.