aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-06-18 17:33:31 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-06-23 12:54:25 -0400
commitf2dff41dbc95812b4fa9f36279e6daf6999e4452 (patch)
treeb9cbbb0135ccfa5e80b06cbd1c9bf710e3a57813 /pkg
parent510509bafcdd055b4a6819ed300db7292c6fb6b8 (diff)
downloadpodman-f2dff41dbc95812b4fa9f36279e6daf6999e4452.tar.gz
podman-f2dff41dbc95812b4fa9f36279e6daf6999e4452.tar.bz2
podman-f2dff41dbc95812b4fa9f36279e6daf6999e4452.zip
Support log_tag defaults from containers.conf
Fixes: https://github.com/containers/podman/issues/10204 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/generate/container.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index d00e51e82..1f6d00eb7 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -7,12 +7,14 @@ import (
"github.com/containers/common/libimage"
"github.com/containers/podman/v3/libpod"
+ "github.com/containers/podman/v3/libpod/define"
ann "github.com/containers/podman/v3/pkg/annotations"
envLib "github.com/containers/podman/v3/pkg/env"
"github.com/containers/podman/v3/pkg/signal"
"github.com/containers/podman/v3/pkg/specgen"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@@ -203,6 +205,17 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
if len(s.LogConfiguration.Driver) < 1 {
s.LogConfiguration.Driver = rtc.Containers.LogDriver
}
+ if len(rtc.Containers.LogTag) > 0 {
+ if s.LogConfiguration.Driver != define.JSONLogging {
+ if s.LogConfiguration.Options == nil {
+ s.LogConfiguration.Options = make(map[string]string)
+ }
+
+ s.LogConfiguration.Options["tag"] = rtc.Containers.LogTag
+ } else {
+ logrus.Warnf("log_tag %q is not allowed with %q log_driver", rtc.Containers.LogTag, define.JSONLogging)
+ }
+ }
warnings, err := verifyContainerResources(s)
if err != nil {