From b70376a59f452366016073d23f6bb67f9b7da9b3 Mon Sep 17 00:00:00 2001 From: Daniel Pawlik Date: Tue, 6 Jun 2023 10:13:54 +0200 Subject: [PATCH] Set log_size_max size for podman logs The service logs after a while can be really huge. This change is limiting log file size to 1GB. The feature has been added into the podman containers.conf file in podman 2.2.0 release [1], but on Centos 7, version is below 2.2.0. According to the libpod.conf man [2], that option should be also available in podman 1.6.4, but it is located in libpod.conf file. More info [3]. [1] https://github.com/containers/podman/releases/tag/v2.2.0 [2] https://manpages.debian.org/unstable/podman/libpod.conf.5.en.html [3] https://github.com/unifi-utilities/unifios-utilities/issues/100 Depends-On: https://softwarefactory-project.io/r/c/software-factory/sf-ci/+/28529 Change-Id: Ia6071e5214644bdd126cf696cd437c140fa95c94 --- ansible/roles/sf-base/defaults/main.yml | 3 +++ ansible/roles/sf-base/tasks/setup.yml | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/ansible/roles/sf-base/defaults/main.yml b/ansible/roles/sf-base/defaults/main.yml index ae3d74fae..eed3ba574 100644 --- a/ansible/roles/sf-base/defaults/main.yml +++ b/ansible/roles/sf-base/defaults/main.yml @@ -24,3 +24,6 @@ base_sysctl: user.max_user_namespaces: 31089 kernel.sysrq: 0 vm.swappiness: 10 + +# set 1000MB in bytes +log_size_max: 1048576000 diff --git a/ansible/roles/sf-base/tasks/setup.yml b/ansible/roles/sf-base/tasks/setup.yml index 61170462c..36eac635c 100644 --- a/ansible/roles/sf-base/tasks/setup.yml +++ b/ansible/roles/sf-base/tasks/setup.yml @@ -146,3 +146,11 @@ - name: Trust crt shell: update-ca-trust when: new_crt is changed + +- name: Set max log limit in libpod configuration file + become: true + lineinfile: + path: /etc/containers/libpod.conf + regexp: "^max_log_size" + line: "max_log_size={{ log_size_max }}" + create: true