summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-24 05:47:10 -0400
committerGitHub <noreply@github.com>2021-06-24 05:47:10 -0400
commitda33fc45b6628c1ac1a16e49790be2b4fbf502a5 (patch)
treed353296c94d74bd2dc3d445ad46de4c6df769037 /pkg/specgen
parent63626e9b583da3929e8ed1020deed97c14bd2206 (diff)
parentf2dff41dbc95812b4fa9f36279e6daf6999e4452 (diff)
downloadpodman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.tar.gz
podman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.tar.bz2
podman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.zip
Merge pull request #10583 from rhatdan/log
Support log_tag defaults from containers.conf
Diffstat (limited to 'pkg/specgen')
-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 e7276892d..ca92f558d 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"
)
@@ -204,6 +206,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 {