Subject: [PATCH] main/fail2ban: Call flushlogs in postrotate

From: [email-masked]
Date: Wed, 11 Dec 2019 15:32:22 +0100

From: Jonas Hagen <[email-masked]>

This fixes the issue of having empty log files after each log rotate.
"set logtarget" does nothing if path did not change. Use "flushlogs" instead:
https://github.com/fail2ban/fail2ban/issues/2243
---
 main/fail2ban/fail2ban.logrotate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/fail2ban/fail2ban.logrotate b/main/fail2ban/fail2ban.logrotate
index f635c3ddde..6afc62c23f 100644
--- a/main/fail2ban/fail2ban.logrotate
+++ b/main/fail2ban/fail2ban.logrotate
@@ -4,7 +4,7 @@
     missingok
     compress
     postrotate
-	/usr/bin/fail2ban-client set logtarget /var/log/fail2ban.log 1>/dev/null || true
+ 	/usr/bin/fail2ban-client flushlogs >/dev/null || true
 	chown :wheel /var/log/fail2ban.log
 	chmod 640 /var/log/fail2ban.log
     endscript
-- 
2.19.1