[TRAIN-ONLY] Ensure we clean old ansible logs in mistral
While we do rotate the ansible.log file, it's never cleaned. This can lead to some issues, depending on the amount of day-2 operations (scaling, update, etc) - increasing size without control is usually a bad thing. Notes: - we're using `find' instead of tmpwatch, because we want to target precise file pattern to remove. tmpwatch does the exact contrary. - we're pushing the `find' in the existing container log cleaning, so that we don't have to edit newer releases to remove any new script we may want to add - mistral being removed in newer releases (stable/wallaby), we can safely make this "train-only", and let newer releases override that script so that we don't have dangling things Resolves: rhbz#2144483 Change-Id: Ifbd990f15b9d85260ab20a2004fe79bafda929d9
This commit is contained in:
parent
073030b338
commit
64dd13b7b1
|
@ -109,6 +109,8 @@ outputs:
|
||||||
when: step|int == 2
|
when: step|int == 2
|
||||||
block:
|
block:
|
||||||
- name: Push script
|
- name: Push script
|
||||||
|
vars:
|
||||||
|
LogrotatePurgeAfterDays: {get_param: LogrotatePurgeAfterDays}
|
||||||
copy:
|
copy:
|
||||||
dest: /usr/local/sbin/containers-tmpwatch
|
dest: /usr/local/sbin/containers-tmpwatch
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -122,9 +124,11 @@ outputs:
|
||||||
-X "/var/log/containers/*/*err" \
|
-X "/var/log/containers/*/*err" \
|
||||||
{{ LogrotatePurgeAfterDays|int +1 }}d \
|
{{ LogrotatePurgeAfterDays|int +1 }}d \
|
||||||
/var/log/containers/ 2>&1 | logger -t container-tmpwatch
|
/var/log/containers/ 2>&1 | logger -t container-tmpwatch
|
||||||
vars:
|
find /var/lib/mistral -type f \
|
||||||
LogrotatePurgeAfterDays: {get_param: LogrotatePurgeAfterDays}
|
-iname '*.log-*' \
|
||||||
- name: Insert cronjob in root crontab
|
-atime +{{ LogrotatePurgeAfterDays|int +1 }} \
|
||||||
|
-print -delete >&1 | logger -t mistral-log-clean
|
||||||
|
- name: Insert cronjob in root crontab for containers logs
|
||||||
cron:
|
cron:
|
||||||
name: "Remove old logs"
|
name: "Remove old logs"
|
||||||
special_time: "daily"
|
special_time: "daily"
|
||||||
|
|
Loading…
Reference in New Issue