c5d8c8
From 0bb71e1492b1ad442758399eb8dcb5f087d77f12 Mon Sep 17 00:00:00 2001
c5d8c8
From: Nikhil Ladha <nladha@redhat.com>
c5d8c8
Date: Wed, 28 Apr 2021 02:14:27 +0530
c5d8c8
Subject: [PATCH 589/610] extras: fix for postscript failure on logrotation of
c5d8c8
 snapd logs (#2310)
c5d8c8
c5d8c8
Issue:
c5d8c8
On executing the logrotate command, the postscript runs as a separate process,
c5d8c8
and when we do a grep for the snapd process it returns the PID of that
c5d8c8
short-term process as well, and executing a kill on that throws the error.
c5d8c8
To check a similar error could be seen if we replace the killall for bricks
c5d8c8
log rotation with a for loop on PIDs.
c5d8c8
c5d8c8
Fix:
c5d8c8
Use the killall command on the list of snapd processes instead of
c5d8c8
using the kill command to individually kill them.
c5d8c8
c5d8c8
>Fixes: #2360
c5d8c8
>Change-Id: I1ad6e3e4d74128706e71900d02e715635294ff72
c5d8c8
>Signed-off-by: nik-redhat <nladha@redhat.com>
c5d8c8
c5d8c8
Upstream patch: https://github.com/gluster/glusterfs/pull/2310
c5d8c8
BUG: 1668303
c5d8c8
c5d8c8
Change-Id: I59910fc3660e11e131b1aa813848c2e19cbffefd
c5d8c8
Signed-off-by: nik-redhat <nladha@redhat.com>
c5d8c8
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/279533
c5d8c8
Tested-by: RHGS Build Bot <nigelb@redhat.com>
c5d8c8
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
c5d8c8
---
c5d8c8
 extras/glusterfs-logrotate | 19 +++++++++++++++++++
c5d8c8
 1 file changed, 19 insertions(+)
c5d8c8
c5d8c8
diff --git a/extras/glusterfs-logrotate b/extras/glusterfs-logrotate
c5d8c8
index 75f700e..2b9028b 100644
c5d8c8
--- a/extras/glusterfs-logrotate
c5d8c8
+++ b/extras/glusterfs-logrotate
c5d8c8
@@ -45,3 +45,22 @@
c5d8c8
   compress
c5d8c8
   delaycompress
c5d8c8
 }
c5d8c8
+
c5d8c8
+# Rotate snapd log
c5d8c8
+/var/log/glusterfs/snaps/*/*.log {
c5d8c8
+    sharedscripts
c5d8c8
+    weekly
c5d8c8
+    maxsize 10M
c5d8c8
+    minsize 100k
c5d8c8
+
c5d8c8
+    # 6 months of logs are good enough
c5d8c8
+    rotate 26
c5d8c8
+
c5d8c8
+    missingok
c5d8c8
+    compress
c5d8c8
+    delaycompress
c5d8c8
+    notifempty
c5d8c8
+    postrotate
c5d8c8
+    /usr/bin/killall -HUP `pgrep -f "glusterfs.*snapd"` > /dev/null 2>&1 || true
c5d8c8
+    endscript
c5d8c8
+}
c5d8c8
-- 
c5d8c8
1.8.3.1
c5d8c8