summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-05 16:33:09 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-05 17:51:45 -0400
commit348f2df0c09e2e3b517add5271e6eee583800be3 (patch)
treeeac3576a5ea40c71de7a8390fbd772a369219d8b /libpod/oci_conmon_linux.go
parent1b16fcfd14b9e761849e53ac2b83c964ad8ac5a9 (diff)
downloadpodman-348f2df0c09e2e3b517add5271e6eee583800be3.tar.gz
podman-348f2df0c09e2e3b517add5271e6eee583800be3.tar.bz2
podman-348f2df0c09e2e3b517add5271e6eee583800be3.zip
Support max_size logoptions
Docker supports log-opt max_size and so does conmon (ALthough poorly). Adding support for this allows users to at least make sure their containers logs do not become a DOS vector. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 1d4f33794..5e73bffe0 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1352,10 +1352,6 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
}
args = append(args, "-l", logDriverArg)
- if r.logSizeMax >= 0 {
- args = append(args, "--log-size-max", fmt.Sprintf("%v", r.logSizeMax))
- }
-
logLevel := logrus.GetLevel()
args = append(args, "--log-level", logLevel.String())
@@ -1363,6 +1359,15 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
logrus.Debugf("%s messages will be logged to syslog", r.conmonPath)
args = append(args, "--syslog")
}
+
+ size := r.logSizeMax
+ if ctr.config.LogSize > 0 {
+ size = ctr.config.LogSize
+ }
+ if size > 0 {
+ args = append(args, "--log-size-max", fmt.Sprintf("%v", size))
+ }
+
if ociLogPath != "" {
args = append(args, "--runtime-arg", "--log-format=json", "--runtime-arg", "--log", fmt.Sprintf("--runtime-arg=%s", ociLogPath))
}