aboutsummaryrefslogtreecommitdiff
path: root/pkg/spec/parse.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-01-07 13:41:56 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-01-10 10:35:19 +0100
commit71341a194843fadf836b5460d09f685bb6c465b4 (patch)
tree115b8394df383e81b40d322cabc864f576ed6478 /pkg/spec/parse.go
parentf3fc10feb42930def6922fc050096ea38bafed7a (diff)
downloadpodman-71341a194843fadf836b5460d09f685bb6c465b4.tar.gz
podman-71341a194843fadf836b5460d09f685bb6c465b4.tar.bz2
podman-71341a194843fadf836b5460d09f685bb6c465b4.zip
log: support --log-opt tag=
support a custom tag to add to each log for the container. It is currently supported only by the journald backend. Closes: https://github.com/containers/libpod/issues/3653 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/spec/parse.go')
-rw-r--r--pkg/spec/parse.go13
1 files changed, 10 insertions, 3 deletions
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