Skip to content

Commit

Permalink
infra: add log rotation support (containers)
Browse files Browse the repository at this point in the history
This commit adds the log rotation support via logrotate in containerized
deployments.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1848388

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f1aa6ce)
  • Loading branch information
guits committed Aug 12, 2020
1 parent 8a7e419 commit 29d4c42
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions roles/ceph-infra/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@
include_tasks: setup_ntp.yml
when: ntp_service_enabled | bool
tags: configure_ntp

- name: ensure logrotate is installed
package:
name: logrotate
state: present
register: result
until: result is succeeded
when: not is_atomic | bool

- name: add logrotate configuration
template:
src: logrotate.conf.j2
dest: /etc/logrotate.d/ceph
mode: "0644"
owner: root
group: root
when: containerized_deployment | bool
12 changes: 12 additions & 0 deletions roles/ceph-infra/templates/logrotate.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/var/log/ceph/*.log {
rotate 7
daily
compress
sharedscripts
postrotate
killall -q -1 ceph-mon ceph-mgr ceph-mds ceph-osd ceph-fuse radosgw rbd-mirror || pkill -1 -x "ceph-mon|ceph-mgr|ceph-mds|ceph-osd|ceph-fuse|radosgw|rbd-mirror" || true
endscript
missingok
notifempty
su root root
}

0 comments on commit 29d4c42

Please sign in to comment.