Add Json logger
This commit is contained in:
@@ -19,6 +19,7 @@ RUN apt-get install -y --no-install-recommends supervisor \
|
||||
postfix-pcre \
|
||||
syslog-ng \
|
||||
syslog-ng-core \
|
||||
syslog-ng-mod-redis \
|
||||
ca-certificates \
|
||||
gnupg \
|
||||
python-gpgme \
|
||||
@@ -29,11 +30,13 @@ RUN apt-get install -y --no-install-recommends supervisor \
|
||||
RUN addgroup --system --gid 600 zeyple
|
||||
RUN adduser --system --home /var/lib/zeyple --no-create-home --uid 600 --gid 600 --disabled-login zeyple
|
||||
RUN touch /var/log/zeyple.log && chown zeyple: /var/log/zeyple.log
|
||||
RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf
|
||||
|
||||
RUN touch /etc/default/locale
|
||||
|
||||
COPY zeyple.py /usr/local/bin/zeyple.py
|
||||
COPY zeyple.conf /etc/zeyple.conf
|
||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||
COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
||||
COPY postfix.sh /opt/postfix.sh
|
||||
COPY whitelist_forwardinghosts.sh /usr/local/bin/whitelist_forwardinghosts.sh
|
||||
|
||||
|
@@ -12,7 +12,7 @@ command=/opt/postfix.sh
|
||||
autorestart=true
|
||||
|
||||
[program:postfix-maillog]
|
||||
command=/bin/tail -f /var/log/zeyple.log /var/log/mail.log
|
||||
command=/bin/tail -f /var/log/zeyple.log /var/log/combined.log
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
|
31
data/Dockerfiles/postfix/syslog-ng.conf
Normal file
31
data/Dockerfiles/postfix/syslog-ng.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
@version: 3.8
|
||||
@include "scl.conf"
|
||||
options {
|
||||
chain_hostnames(off);
|
||||
flush_lines(0);
|
||||
use_dns(no);
|
||||
use_fqdn(no);
|
||||
owner("root"); group("adm"); perm(0640);
|
||||
stats_freq(0);
|
||||
bad_hostname("^gconfd$");
|
||||
};
|
||||
source s_src {
|
||||
unix-stream("/dev/log");
|
||||
internal();
|
||||
};
|
||||
|
||||
destination d_combined { file("/var/log/combined.log"); };
|
||||
destination d_redis {
|
||||
redis(
|
||||
host("redis-mailcow")
|
||||
port(6379)
|
||||
command("LPUSH" "POSTFIX_MAILLOG" "$(format-json time=\"$S_UNIXTIME\" priority=\"$PRIORITY\" program=\"$PROGRAM\" message=\"$MESSAGE\")\n")
|
||||
);
|
||||
};
|
||||
filter f_mail { facility(mail) and not filter(f_debug); };
|
||||
log {
|
||||
source(s_src);
|
||||
destination(d_combined);
|
||||
filter(f_mail);
|
||||
destination(d_redis);
|
||||
};
|
Reference in New Issue
Block a user