]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
long_running_cluster: Custom logrotate rules 386/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 28 Mar 2018 15:17:41 +0000 (11:17 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 28 Mar 2018 15:23:45 +0000 (11:23 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/long_running_cluster/tasks/logrotate.yml [new file with mode: 0644]
roles/long_running_cluster/tasks/main.yml
roles/long_running_cluster/templates/ceph-common.logrotate [new file with mode: 0644]

diff --git a/roles/long_running_cluster/tasks/logrotate.yml b/roles/long_running_cluster/tasks/logrotate.yml
new file mode 100644 (file)
index 0000000..bf66a6e
--- /dev/null
@@ -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
index 0921fcc219a2ce72f23917f718db5be2269e2238..d298c0509570a7e8efbaea68ab39090b970ab7ca 100644 (file)
@@ -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 (file)
index 0000000..12fe9d1
--- /dev/null
@@ -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
+}