From 095aaaa639ab57c594bb80bfefbfaed2a2fdff92 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 30 Jan 2018 06:23:58 +0100 Subject: Allow users to specify logpath Signed-off-by: Daniel J Walsh Closes: #135 Approved by: mheon --- cmd/podman/parse.go | 12 ++++++++++++ cmd/podman/spec.go | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/parse.go b/cmd/podman/parse.go index 33988a3b6..0d1a0b925 100644 --- a/cmd/podman/parse.go +++ b/cmd/podman/parse.go @@ -773,3 +773,15 @@ func stringSlicetoUint32Slice(inputSlice []string) ([]uint32, error) { } return outputSlice, nil } + +func getLoggingPath(opts []string) 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]) + } + } + } + return "" +} diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go index a14bd7dfb..d21d8b6da 100644 --- a/cmd/podman/spec.go +++ b/cmd/podman/spec.go @@ -608,6 +608,10 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er if len(c.HostAdd) > 0 { options = append(options, libpod.WithHosts(c.HostAdd)) } + logPath := getLoggingPath(c.LogDriverOpt) + if logPath != "" { + options = append(options, libpod.WithLogPath(logPath)) + } options = append(options, libpod.WithPrivileged(c.Privileged)) return options, nil -- cgit v1.2.3-54-g00ecf