Replace gitlab-runner/log/system_logger with standard logrus/hooks/syslog. There are two reasons: 1. gitlab-runner/log/system_logger delegates the syslog initialization (syslog.Dial) to kardianos/service, which doesn't set the syslog facility. This results in messages logged with the "kern" facility. 2. gitlab-runner/log/system_logger maps Error, Panic, and Fatal levels to the syslog's "err" level, but Panic and Fatal could be mapped to the "crit" level. I didn't contribute this patch to the upstream because I don't wanna contribute to any Go projects. However, if you find this patch useful, feel free to send it to the upstream under your name. diff --git a/commands/multi.go b/commands/multi.go index e62594be6..a0c2d659b 100644 --- a/commands/multi.go +++ b/commands/multi.go @@ -37,6 +37,9 @@ import ( "gitlab.com/gitlab-org/gitlab-runner/log" "gitlab.com/gitlab-org/gitlab-runner/network" "gitlab.com/gitlab-org/gitlab-runner/session" + + "log/syslog" + lSyslog "github.com/sirupsen/logrus/hooks/syslog" ) const ( @@ -1462,7 +1465,13 @@ func (mr *RunCommand) Execute(_ *cli.Context) { } if mr.Syslog { - log.SetSystemLogger(logrus.StandardLogger(), svc) + hook, err := lSyslog.NewSyslogHook("", "", syslog.LOG_DAEMON | syslog.LOG_INFO, mr.ServiceName) + if err == nil { + logrus.AddHook(hook) + } else { + logrus.WithError(err). + Error("Error while setting up the system logger") + } } mr.sentryLogHookMutex.Lock()