summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/spec/createconfig.go5
-rw-r--r--pkg/spec/parse.go13
2 files changed, 14 insertions, 4 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 244a8d1cd..6d058229b 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -282,10 +282,13 @@ func (c *CreateConfig) getContainerCreateOptions(runtime *libpod.Runtime, pod *l
options = append(options, libpod.WithStopSignal(c.StopSignal))
options = append(options, libpod.WithStopTimeout(c.StopTimeout))
- logPath := getLoggingPath(c.LogDriverOpt)
+ logPath, logTag := getLoggingOpts(c.LogDriverOpt)
if logPath != "" {
options = append(options, libpod.WithLogPath(logPath))
}
+ if logTag != "" {
+ options = append(options, libpod.WithLogTag(logTag))
+ }
if c.LogDriver != "" {
options = append(options, libpod.WithLogDriver(c.LogDriver))
diff --git a/pkg/spec/parse.go b/pkg/spec/parse.go
index c2572a033..6fa0b0636 100644
--- a/pkg/spec/parse.go
+++ b/pkg/spec/parse.go
@@ -132,16 +132,23 @@ func validateIOpsDevice(val string) (*throttleDevice, error) { //nolint
}, nil
}
-func getLoggingPath(opts []string) string {
+// getLoggingOpts splits the path= and tag= options provided to --log-opt.
+func getLoggingOpts(opts []string) (string, string) {
+ var path, tag string
for _, opt := range opts {
arr := strings.SplitN(opt, "=", 2)
if len(arr) == 2 {
if strings.TrimSpace(arr[0]) == "path" {
- return strings.TrimSpace(arr[1])
+ path = strings.TrimSpace(arr[1])
+ } else if strings.TrimSpace(arr[0]) == "tag" {
+ tag = strings.TrimSpace(arr[1])
}
}
+ if path != "" && tag != "" {
+ break
+ }
}
- return ""
+ return path, tag
}
// ParseDevice parses device mapping string to a src, dest & permissions string