copr/hv: delete logs older than 30 days

We have old RHEL 8 on hypervisors where is old version of virtlogd, not
having the max_age log rotation feature, thus doing this manually.
This commit is contained in:
Jiri Kyjovsky 2025-05-05 11:27:53 +02:00
parent 69237d1349
commit 2dc4a6b5c0
2 changed files with 9 additions and 17 deletions

View file

@ -1,7 +0,0 @@
# We log each WM that has beed spawned to a log and once it shuts down
# the log is closed and we keep that small log. New machines logs their
# output to new file. So this way we keep the small logs of each WM
# for 30 days.
max_age_days = 30
log_root = "/var/log/libvirt/qemu"

View file

@ -201,13 +201,12 @@
provision_user: copr
tags: always
- name: Deploy virtlogd.conf
ansible.builtin.copy:
src: virtlogd.conf
dest: /etc/libvirt/virtlogd.conf
owner: root
group: root
mode: '0644'
notify: Reload virtlogd
tags:
- config
- name: Ensure weekly cleanup of virtlogd/qemu logs older than 30 days
ansible.builtin.cron:
name: "Cleanup old virtlogd-qemu logs"
minute: 0
hour: 3
weekday: 1
user: root
job: |
find /var/log/libvirt/qemu -maxdepth 1 -type f -name '*.log' -mtime +30 -delete