Files
podman/cmd/podman/syslog_common.go
Paul Holzinger 3f8ee70d0c 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 <pholzing@redhat.com>
2023-07-10 11:45:59 +02:00

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)
}
}