mirror of
https://github.com/containers/podman.git
synced 2025-09-12 01:38:59 +08:00

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 <pholzing@redhat.com>
25 lines
422 B
Go
25 lines
422 B
Go
//go:build linux || freebsd
|
|
// +build linux freebsd
|
|
|
|
package main
|
|
|
|
import (
|
|
"log/syslog"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
logrusSyslog "github.com/sirupsen/logrus/hooks/syslog"
|
|
)
|
|
|
|
func syslogHook() {
|
|
if !useSyslog {
|
|
return
|
|
}
|
|
|
|
hook, err := logrusSyslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
|
|
if err != nil {
|
|
logrus.Debug("Failed to initialize syslog hook: " + err.Error())
|
|
} else {
|
|
logrus.AddHook(hook)
|
|
}
|
|
}
|