From 29ccd38eaa527f389852614a420cbdb6dea12051 Mon Sep 17 00:00:00 2001 From: Zhuo Zhen Date: Fri, 7 Feb 2020 14:08:59 -0600 Subject: [PATCH] Configurable logrotate rotation interval and count The logrotate rotation interval and count are not configurable. Currently, the configuration is a "default" that keeps 6 weeks of logs. Change-Id: I4f55ee2a98f7861cb8de2724f5edc32da6d2f9ee --- ansible/roles/common/defaults/main.yml | 3 +++ .../roles/common/templates/cron-logrotate-global.conf.j2 | 4 ++-- ...d-logrotate-configurable-variables-05cb3c5ede5c14fd.yaml | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-logrotate-configurable-variables-05cb3c5ede5c14fd.yaml diff --git a/ansible/roles/common/defaults/main.yml b/ansible/roles/common/defaults/main.yml index 1b947b0caf..60db9bf3ed 100644 --- a/ansible/roles/common/defaults/main.yml +++ b/ansible/roles/common/defaults/main.yml @@ -88,3 +88,6 @@ fluentd_default_volumes: kolla_toolbox_extra_volumes: "{{ default_extra_volumes }}" cron_extra_volumes: "{{ default_extra_volumes }}" fluentd_extra_volumes: "{{ default_extra_volumes }}" + +cron_logrotate_rotation_interval: "weekly" +cron_logrotate_rotation_count: 6 diff --git a/ansible/roles/common/templates/cron-logrotate-global.conf.j2 b/ansible/roles/common/templates/cron-logrotate-global.conf.j2 index c21e3d1c07..0b0c9b4188 100644 --- a/ansible/roles/common/templates/cron-logrotate-global.conf.j2 +++ b/ansible/roles/common/templates/cron-logrotate-global.conf.j2 @@ -1,6 +1,6 @@ -weekly +{{ cron_logrotate_rotation_interval }} -rotate 6 +rotate {{ cron_logrotate_rotation_count }} copytruncate diff --git a/releasenotes/notes/add-logrotate-configurable-variables-05cb3c5ede5c14fd.yaml b/releasenotes/notes/add-logrotate-configurable-variables-05cb3c5ede5c14fd.yaml new file mode 100644 index 0000000000..957c3e2ff8 --- /dev/null +++ b/releasenotes/notes/add-logrotate-configurable-variables-05cb3c5ede5c14fd.yaml @@ -0,0 +1,6 @@ +--- +features: + - > + Adds configuration variables ``cron_logrotate_rotation_interval`` and + ``cron_logrotate_rotation_count`` to set the logrotate rotation interval + and count.