Skip to content

Commit

Permalink
Set log_size_max size for podman logs
Browse files Browse the repository at this point in the history
Sometimes the logs can take over 20GB in few weeks.
By setting 1GB as log_size_max should avoid situation that we are
out of the disk few times per week.
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] unifi-utilities/unifios-utilities#100

Change-Id: Ic6d01e11606c9526d1880583876d76c4415250ac
  • Loading branch information
danpawlik committed Jun 13, 2023
1 parent d4a68e0 commit 86e9b70
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions playbooks/site_rdo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
roles:
- service/node-exporter
- system/update-host
- system/podman

- hosts: backup-rdo
roles:
Expand Down
1 change: 1 addition & 0 deletions playbooks/site_sf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- infra/ssh
- service/node-exporter
- system/update-host
- system/podman

- hosts: backup-sf
roles:
Expand Down
3 changes: 3 additions & 0 deletions roles/system/podman/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# set 1000MB in bytes
log_size_max: 1048576000
18 changes: 18 additions & 0 deletions roles/system/podman/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Set max log limit - new way
become: true
ini_file:
path: /etc/containers/containers.conf
section: containers
option: log_size_max
value: "{{ log_size_max }}"
backup: true

- name: Set max log limit - legacy
become: true
lineinfile:
path: /etc/containers/libpod.conf
regexp: "^max_log_size"
line: "max_log_size={{ log_size_max }}"
create: true
when: ansible_distribution_major_version|int < 8

0 comments on commit 86e9b70

Please sign in to comment.