summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-07-12 14:34:37 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-12 21:19:05 +0000
commite615b7d67124c548a3c7b422348821204ce32775 (patch)
tree6290966b07459aba3aee3b77fe8ed8ca6d72ffff /cmd/podman
parent4f188aa191f1d28be19af64317bd8512f5c0cac0 (diff)
downloadpodman-e615b7d67124c548a3c7b422348821204ce32775.tar.gz
podman-e615b7d67124c548a3c7b422348821204ce32775.tar.bz2
podman-e615b7d67124c548a3c7b422348821204ce32775.zip
Log all output of logrus to syslog as well as stdout/stderr
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1084 Approved by: baude
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/main.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index fefd8fdad..f533a8b13 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -14,7 +14,9 @@ import (
"github.com/projectatomic/libpod/pkg/rootless"
"github.com/projectatomic/libpod/version"
"github.com/sirupsen/logrus"
+ lsyslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/urfave/cli"
+ "log/syslog"
)
// This is populated by the Makefile from the VERSION file
@@ -94,6 +96,12 @@ func main() {
}
app.Before = func(c *cli.Context) error {
+ if c.GlobalBool("syslog") {
+ hook, err := lsyslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
+ if err == nil {
+ logrus.AddHook(hook)
+ }
+ }
logLevel := c.GlobalString("log-level")
if logLevel != "" {
level, err := logrus.ParseLevel(logLevel)
@@ -187,6 +195,10 @@ func main() {
Name: "storage-opt",
Usage: "used to pass an option to the storage driver",
},
+ cli.BoolFlag{
+ Name: "syslog",
+ Usage: "output logging information to syslog as well as the console",
+ },
}
if _, err := os.Stat("/etc/containers/registries.conf"); err != nil {
if os.IsNotExist(err) {