diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-06-22 15:05:22 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-06-25 15:42:32 -0400 |
commit | 2ad9dcc07e3062653e3da0c5639a837d3af8b99e (patch) | |
tree | 966b9db947b1f5645fadf11df09105a9ef8d988f /pkg/specgen | |
parent | 723a9e308f586b5c265ab5ca11f9932b98ce4243 (diff) | |
download | podman-2ad9dcc07e3062653e3da0c5639a837d3af8b99e.tar.gz podman-2ad9dcc07e3062653e3da0c5639a837d3af8b99e.tar.bz2 podman-2ad9dcc07e3062653e3da0c5639a837d3af8b99e.zip |
Set syslog for exit commands on log-level=debug
We have a flag, --syslog, for telling logrus to log to syslog as
well as to the terminal. Previously, this flag also set the exit
command for containers to use `--syslog` (otherwise all output
from exit commands is lost). I attempted to replicate this with
Podman v2.0, but quickly ran into circular import hell (the flag
is defined in cmd/podman, I needed it in cmd/podman/containers,
cmd/podman imports cmd/podman/containers already, etc). Instead,
let's just set the syslog flag automatically on
`--log-level=debug` so we log exit commands automatically when
debug-level logs are requested. This is consistent with Conmon
and seems to make sense.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 3 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 2f7100e7e..59414e668 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -110,8 +110,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener } options = append(options, opts...) - // TODO: Enable syslog support - we'll need to put this in SpecGen. - exitCommandArgs, err := CreateExitCommandArgs(rt.StorageConfig(), rtc, false, s.Remove, false) + exitCommandArgs, err := CreateExitCommandArgs(rt.StorageConfig(), rtc, logrus.IsLevelEnabled(logrus.DebugLevel), s.Remove, false) if err != nil { return nil, err } diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 77b1353c4..03e840ab4 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -129,7 +129,7 @@ type ContainerBasicConfig struct { Sysctl map[string]string `json:"sysctl,omitempty"` // Remove indicates if the container should be removed once it has been started // and exits - Remove bool `json:"remove"` + Remove bool `json:"remove,omitempty"` } // ContainerStorageConfig contains information on the storage configuration of a |