From bdd19117d308a50141edf5169075ab6d1cf7c145 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 28 Mar 2018 11:17:41 -0400 Subject: [PATCH] long_running_cluster: Custom logrotate rules Signed-off-by: David Galloway --- .../long_running_cluster/tasks/logrotate.yml | 19 +++++++++++++++++++ roles/long_running_cluster/tasks/main.yml | 4 ++++ .../templates/ceph-common.logrotate | 12 ++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 roles/long_running_cluster/tasks/logrotate.yml create mode 100644 roles/long_running_cluster/templates/ceph-common.logrotate diff --git a/roles/long_running_cluster/tasks/logrotate.yml b/roles/long_running_cluster/tasks/logrotate.yml new file mode 100644 index 00000000..bf66a6eb --- /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 0921fcc2..d298c050 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 00000000..12fe9d18 --- /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 +} -- 2.47.3