浏览代码

[Dovecot, Postfix, SOGo] Fix redis log cleanup, fixes #542

andryyy 8 年之前
父节点
当前提交
1f90433429

+ 10 - 1
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);
+
 };

+ 9 - 1
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);
 };

+ 9 - 1
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);