From: David Galloway Date: Wed, 28 Mar 2018 15:17:41 +0000 (-0400) Subject: long_running_cluster: Custom logrotate rules X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bdd19117d308a50141edf5169075ab6d1cf7c145;p=ceph-cm-ansible.git long_running_cluster: Custom logrotate rules Signed-off-by: David Galloway --- diff --git a/roles/long_running_cluster/tasks/logrotate.yml b/roles/long_running_cluster/tasks/logrotate.yml new file mode 100644 index 0000000..bf66a6e --- /dev/null +++ b/roles/long_running_cluster/tasks/logrotate.yml @@ -0,0 +1,19 @@ +--- +# Because of the high debug level enabled for LRC daemons, the root drives +# fill up rather quickly. The drives fill up before the daily logrotate can +# run so we rotate every 6 hours and keep 3 days worth. This can be adjusted +# as needed. Logrotate already runs daily at 06:25 so there are 3 additional +# scheduled cronjobs to rotate 4x daily. + +- name: "Write custom ceph logrotate config" + template: + src: ceph-common.logrotate + dest: /etc/logrotate.d/ceph-common + +- name: "Create cronjob to logrotate every 6 hours" + cron: + name: "Logrotate ceph logs every 6 hours" + minute: "25" + hour: "0,12,18" + job: "/usr/sbin/logrotate -f /etc/logrotate.d/ceph-common" + user: root diff --git a/roles/long_running_cluster/tasks/main.yml b/roles/long_running_cluster/tasks/main.yml index 0921fcc..d298c05 100644 --- a/roles/long_running_cluster/tasks/main.yml +++ b/roles/long_running_cluster/tasks/main.yml @@ -8,3 +8,7 @@ - import_tasks: nagios.yml when: mon_service_status.rc == 0 + +- import_tasks: logrotate.yml + tags: + - logrotate diff --git a/roles/long_running_cluster/templates/ceph-common.logrotate b/roles/long_running_cluster/templates/ceph-common.logrotate new file mode 100644 index 0000000..12fe9d1 --- /dev/null +++ b/roles/long_running_cluster/templates/ceph-common.logrotate @@ -0,0 +1,12 @@ +# {{ ansible_managed }} +/var/log/ceph/*.log { + rotate 12 + compress + sharedscripts + postrotate + killall -q -1 ceph-mon ceph-mgr ceph-mds ceph-osd ceph-fuse radosgw || true + endscript + missingok + notifempty + su root ceph +}