From 1f9043342976768cc41ce136b5910146d8345512 Mon Sep 17 00:00:00 2001 From: andryyy Date: Sun, 3 Sep 2017 11:57:58 +0200 Subject: [PATCH] [Dovecot, Postfix, SOGo] Fix redis log cleanup, fixes #542 --- data/Dockerfiles/dovecot/syslog-ng.conf | 11 ++++++++++- data/Dockerfiles/postfix/syslog-ng.conf | 10 +++++++++- data/Dockerfiles/sogo/syslog-ng.conf | 10 +++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/dovecot/syslog-ng.conf b/data/Dockerfiles/dovecot/syslog-ng.conf index d14c2ad10..292efc7dd 100644 --- a/data/Dockerfiles/dovecot/syslog-ng.conf +++ b/data/Dockerfiles/dovecot/syslog-ng.conf @@ -20,7 +20,6 @@ destination d_redis_ui_log { persist-name("redis1") port(6379) command("LPUSH" "DOVECOT_MAILLOG" "$(format-json time=\"$S_UNIXTIME\" priority=\"$PRIORITY\" program=\"$PROGRAM\" message=\"$MESSAGE\")\n") - command("LTRIM" "DOVECOT_MAILLOG" "0" "10000") ); }; destination d_redis_f2b_channel { @@ -31,6 +30,14 @@ destination d_redis_f2b_channel { command("PUBLISH" "F2B_CHANNEL" "$MESSAGE") ); }; +destination d_redis_cleanup { + redis( + host("redis-mailcow") + persist-name("redis3") + port(6379) + command("LTRIM" "DOVECOT_MAILLOG" "0" "9999") + ); +}; filter f_mail { facility(mail); }; log { source(s_src); @@ -38,4 +45,6 @@ log { filter(f_mail); destination(d_redis_ui_log); destination(d_redis_f2b_channel); + destination(d_redis_cleanup); + }; diff --git a/data/Dockerfiles/postfix/syslog-ng.conf b/data/Dockerfiles/postfix/syslog-ng.conf index e06b9fa01..cfb76a165 100644 --- a/data/Dockerfiles/postfix/syslog-ng.conf +++ b/data/Dockerfiles/postfix/syslog-ng.conf @@ -20,7 +20,6 @@ destination d_redis_ui_log { persist-name("redis1") port(6379) command("LPUSH" "POSTFIX_MAILLOG" "$(format-json time=\"$S_UNIXTIME\" priority=\"$PRIORITY\" program=\"$PROGRAM\" message=\"$MESSAGE\")\n") - command("LTRIM" "POSTFIX_MAILLOG" "0" "10000") ); }; destination d_redis_f2b_channel { @@ -31,6 +30,14 @@ destination d_redis_f2b_channel { command("PUBLISH" "F2B_CHANNEL" "$MESSAGE") ); }; +destination d_redis_cleanup { + redis( + host("redis-mailcow") + persist-name("redis3") + port(6379) + command("LTRIM" "POSTFIX_MAILLOG" "0" "9999") + ); +}; filter f_mail { facility(mail); }; log { source(s_src); @@ -38,4 +45,5 @@ log { filter(f_mail); destination(d_redis_ui_log); destination(d_redis_f2b_channel); + destination(d_redis_cleanup); }; diff --git a/data/Dockerfiles/sogo/syslog-ng.conf b/data/Dockerfiles/sogo/syslog-ng.conf index 48497e26e..51628353b 100644 --- a/data/Dockerfiles/sogo/syslog-ng.conf +++ b/data/Dockerfiles/sogo/syslog-ng.conf @@ -23,7 +23,6 @@ destination d_redis_ui_log { persist-name("redis1") port(6379) command("LPUSH" "SOGO_LOG" "$(format-json time=\"$S_UNIXTIME\" priority=\"$PRIORITY\" program=\"$PROGRAM\" message=\"$MESSAGE\")\n") - command("LTRIM" "SOGO_LOG" "0" "10000") ); }; destination d_redis_f2b_channel { @@ -34,10 +33,19 @@ destination d_redis_f2b_channel { command("PUBLISH" "F2B_CHANNEL" "$MESSAGE") ); }; +destination d_redis_cleanup { + redis( + host("redis-mailcow") + persist-name("redis3") + port(6379) + command("LTRIM" "SOGO_LOG" "0" "9999") + ); +}; log { source(s_sogo); destination(d_redis_ui_log); destination(d_redis_f2b_channel); + destination(d_redis_cleanup); }; log { source(s_sogo);