From dea2ba1070e755532f736008d2f280ba42c55be5 Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Wed, 17 Apr 2024 11:09:10 +0500 Subject: [PATCH] chore: Update systemd journal configuration --- playbooks/roles/vhost/tasks/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/vhost/tasks/main.yml b/playbooks/roles/vhost/tasks/main.yml index a5ca407e69f..cb2eaa42d99 100644 --- a/playbooks/roles/vhost/tasks/main.yml +++ b/playbooks/roles/vhost/tasks/main.yml @@ -70,12 +70,17 @@ when: COMMON_OBJECT_STORE_LOG_SYNC and not (ansible_distribution_release == 'precise' or ansible_distribution_release == 'trusty') -- name: Set maximum disk space usage for systemd journal +- name: Set maximum disk space usage, free space, retention, and file age for systemd journal lineinfile: path: /etc/systemd/journald.conf - regexp: '^#?SystemMaxUse=' - line: 'SystemMaxUse=1G' + regexp: '^#?{{ item.regexp }}' + line: '{{ item.line }}' state: present + with_items: + - { regexp: 'SystemMaxUse=', line: 'SystemMaxUse=500M' } + - { regexp: 'SystemKeepFree=', line: 'SystemKeepFree=1G' } + - { regexp: 'MaxRetentionSec=', line: 'MaxRetentionSec=1month' } + - { regexp: 'MaxFileSec=', line: 'MaxFileSec=1week' } register: journald_config_line when: ansible_distribution_release == 'bionic' or ansible_distribution_release == 'focal'