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>
This commit is contained in:
Giuseppe Scrivano
2020-01-07 13:41:56 +01:00
parent f3fc10feb4
commit 71341a1948
9 changed files with 133 additions and 19 deletions

View File

@ -379,6 +379,8 @@ type ContainerConfig struct {
CgroupParent string `json:"cgroupParent"`
// LogPath log location
LogPath string `json:"logPath"`
// LogTag is the tag used for logging
LogTag string `json:"logTag"`
// LogDriver driver for logs
LogDriver string `json:"logDriver"`
// File containing the conmon PID
@ -726,6 +728,11 @@ func (c *Container) LogPath() string {
return c.config.LogPath
}
// LogTag returns the tag to the container's log file
func (c *Container) LogTag() string {
return c.config.LogTag
}
// RestartPolicy returns the container's restart policy.
func (c *Container) RestartPolicy() string {
return c.config.RestartPolicy