diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-01-07 13:41:56 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-01-10 10:35:19 +0100 |
commit | 71341a194843fadf836b5460d09f685bb6c465b4 (patch) | |
tree | 115b8394df383e81b40d322cabc864f576ed6478 /libpod/options.go | |
parent | f3fc10feb42930def6922fc050096ea38bafed7a (diff) | |
download | podman-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 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go index 031f4f705..1d6863e7b 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1059,6 +1059,23 @@ func WithLogPath(path string) CtrCreateOption { } } +// WithLogTag sets the tag to the log file. +func WithLogTag(tag string) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + if tag == "" { + return errors.Wrapf(define.ErrInvalidArg, "log tag must be set") + } + + ctr.config.LogTag = tag + + return nil + } + +} + // WithNoCgroups disables the creation of CGroups for the new container. func WithNoCgroups() CtrCreateOption { return func(ctr *Container) error { |