diff --git a/cmd/crio/config.go b/cmd/crio/config.go index 17ec67ca..149bb55a 100644 --- a/cmd/crio/config.go +++ b/cmd/crio/config.go @@ -108,6 +108,10 @@ hooks_dir_path = "{{ .HooksDirPath }}" # pids_limit is the number of processes allowed in a container pids_limit = {{ .PidsLimit }} +# log_size_max is the max limit for the container log size in bytes. +# Negative values indicate that no limit is imposed. +log_size_max = {{ .LogSizeMax }} + # The "crio.image" table contains settings pertaining to the # management of OCI images. [crio.image] diff --git a/libkpod/config.go b/libkpod/config.go index 4a3ade4f..ffcac56c 100644 --- a/libkpod/config.go +++ b/libkpod/config.go @@ -51,6 +51,10 @@ const ( // DefaultPidsLimit is the default value for maximum number of processes // allowed inside a container DefaultPidsLimit = 1024 + + // DefaultLogSizeMax is the default value for the maximum log size + // allowed for a container. Negative values mean that no limit is imposed. + DefaultLogSizeMax = -1 ) // This structure is necessary to fake the TOML tables when parsing, @@ -145,6 +149,12 @@ type RuntimeConfig struct { // by the cgroup process number controller. PidsLimit int64 `toml:"pids_limit"` + // LogSizeMax is the maximum number of bytes after which the log file + // will be truncated. It can be expressed as a human-friendly string + // that is parsed to bytes. + // Negative values indicate that the log file won't be truncated. + LogSizeMax int64 `toml:"log_size_max"` + // ContainerExitsDir is the directory in which container exit files are // written to by conmon. ContainerExitsDir string `toml:"container_exits_dir"` @@ -274,6 +284,7 @@ func DefaultConfig() *Config { PidsLimit: DefaultPidsLimit, ContainerExitsDir: containerExitsDir, HooksDirPath: DefaultHooksDirPath, + LogSizeMax: DefaultLogSizeMax, }, ImageConfig: ImageConfig{ DefaultTransport: defaultTransport,