From c0e196e34aed9ae216e267b03ad98f394b52e04c Mon Sep 17 00:00:00 2001 From: Keigo Noha Date: Mon, 8 Jul 2019 15:00:33 +0900 Subject: [PATCH] Add parameters for dateext in logrotate I798304a472df41b86a88611c97c2c99131faa0ad introduces a support of dateext, dateformat and dateyesterday for containerized logrotate. To use those paramters from T-H-T, this change introduces 3 parameters, LogrotateDateExt, LogrotateDateFormat and LogrotateDateYesterday. Conflicts: docker/services/logrotate-crond.yaml Depends-on: https://review.opendev.org/#/c/669604/ Change-Id: I5156199c7ebb5867be8b38ab6441a010ba3d29f5 (cherry picked from commit ce1c8d139641af8e8e86cfc64b9749a9e759a167) (cherry picked from commit fd84e1df320c551ffbde8a173f8d974638a18b98) (cherry picked from commit 59a5f8338fa85a1410175c9d38ea171d3185530c) --- docker/services/logrotate-crond.yaml | 38 ++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/docker/services/logrotate-crond.yaml b/docker/services/logrotate-crond.yaml index 52c55cf89a..80046db41a 100644 --- a/docker/services/logrotate-crond.yaml +++ b/docker/services/logrotate-crond.yaml @@ -54,6 +54,28 @@ parameters: description: Enforces life time (days) of rotated and compressed files. type: string default: '14' + LogrotateDateExt: + description: Enable/disable dateext parameter. + type: boolean + default: false + LogrotateDateFormat: + description: Configures dateformat strings for containerized logrotate. + This is valid when LogrotateDateExt is true. + The allowed specifiers are only %Y %m %d %H %M %S %V and %s. + type: string + default: '-%Y%m%d' + constraints: + - allowed_pattern: '-(%[YmdHMSVs])+$' + LogrotateDateYesterday: + description: Configures dateyesterday paramter for containerized logrotate. + This is valid when LogrotateDateExt is true. + type: boolean + default: false + +conditions: + + logrotatedateext_is_enabled: {equals: [{get_param: LogrotateDateExt}, true]} + resources: @@ -66,17 +88,23 @@ outputs: value: service_name: logrotate_crond config_settings: - tripleo::profile::base::logging::logrotate::maxsize: {get_param: LogrotateMaxsize} - tripleo::profile::base::logging::logrotate::rotation: {get_param: LogrotateRotationInterval} - tripleo::profile::base::logging::logrotate::rotate: {get_param: LogrotateRotate} - tripleo::profile::base::logging::logrotate::purge_after_days: {get_param: LogrotatePurgeAfterDays} + map_merge: + - tripleo::profile::base::logging::logrotate::maxsize: {get_param: LogrotateMaxsize} + tripleo::profile::base::logging::logrotate::rotation: {get_param: LogrotateRotationInterval} + tripleo::profile::base::logging::logrotate::rotate: {get_param: LogrotateRotate} + tripleo::profile::base::logging::logrotate::purge_after_days: {get_param: LogrotatePurgeAfterDays} + tripleo::profile::base::logging::logrotate::dateext: {get_param: LogrotateDateExt} + - if: + - logrotatedateext_is_enabled + - tripleo::profile::base::logging::logrotate::dateformat: {get_param: LogrotateDateFormat} + tripleo::profile::base::logging::logrotate::dateyesterday: {get_param: LogrotateDateYesterday} + - {} host_prep_tasks: - name: allow logrotate to read inside containers seboolean: name: logrotate_read_inside_containers persistent: yes state: yes - - name: configure tmpwatch on the host copy: dest: /etc/cron.daily/containers-tmpwatch