summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-12-15 09:12:57 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2020-12-15 17:22:06 -0500
commite42d920ebfa381322eb03cb27941ecb93eea3dd7 (patch)
tree4f825a579262861307a1a661fe824696105ab008 /libpod
parente689503fd6995fa45d990fef6ad7de425c1cbcba (diff)
downloadpodman-e42d920ebfa381322eb03cb27941ecb93eea3dd7.tar.gz
podman-e42d920ebfa381322eb03cb27941ecb93eea3dd7.tar.bz2
podman-e42d920ebfa381322eb03cb27941ecb93eea3dd7.zip
Add LogSize to container inspect
Other log options are available so we need to add ability to look up LogSize. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_inspect.go7
-rw-r--r--libpod/define/container_inspect.go9
2 files changed, 11 insertions, 5 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 2ce3e8e68..51474471b 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/libpod/driver"
"github.com/containers/podman/v2/pkg/util"
+ units "github.com/docker/go-units"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
"github.com/opencontainers/runtime-tools/validate"
@@ -124,8 +125,6 @@ func (c *Container) getContainerInspectData(size bool, driverData *driver.Data)
HostnamePath: hostnamePath,
HostsPath: hostsPath,
StaticDir: config.StaticDir,
- LogPath: config.LogPath,
- LogTag: config.LogTag,
OCIRuntime: config.OCIRuntime,
ConmonPidFile: config.ConmonPidFile,
Name: config.Name,
@@ -354,6 +353,10 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
logConfig := new(define.InspectLogConfig)
logConfig.Type = c.config.LogDriver
+ logConfig.Path = c.config.LogPath
+ logConfig.Size = units.HumanSize(float64(c.config.LogSize))
+ logConfig.Tag = c.config.LogTag
+
hostConfig.LogConfig = logConfig
restartPolicy := new(define.InspectRestartPolicy)
diff --git a/libpod/define/container_inspect.go b/libpod/define/container_inspect.go
index 775965477..c15bcedf2 100644
--- a/libpod/define/container_inspect.go
+++ b/libpod/define/container_inspect.go
@@ -82,10 +82,15 @@ type InspectRestartPolicy struct {
}
// InspectLogConfig holds information about a container's configured log driver
-// and is presently unused. It is retained for Docker compatibility.
type InspectLogConfig struct {
Type string `json:"Type"`
Config map[string]string `json:"Config"` //idk type, TODO
+ // Path specifies a path to the log file
+ Path string `json:"Path"`
+ // Tag specifies a custom log tag for the container
+ Tag string `json:"Tag"`
+ // Size specifies a maximum size of the container log
+ Size string `json:"Size"`
}
// InspectBlkioWeightDevice holds information about the relative weight
@@ -620,8 +625,6 @@ type InspectContainerData struct {
StaticDir string `json:"StaticDir"`
OCIConfigPath string `json:"OCIConfigPath,omitempty"`
OCIRuntime string `json:"OCIRuntime,omitempty"`
- LogPath string `json:"LogPath"`
- LogTag string `json:"LogTag"`
ConmonPidFile string `json:"ConmonPidFile"`
Name string `json:"Name"`
RestartCount int32 `json:"RestartCount"`