make syslog optional

master
Michael Wyraz 4 years ago
parent e979743226
commit ca6ea6465c

@ -2,6 +2,11 @@
# General
###############
{% if POSTFIX_LOG_SYSLOG != "local" %}
# Logging configuration
maillog_file = /dev/stdout
{% endif %}
# Main domain and hostname
mydomain = {{ DOMAIN }}
myhostname = {{ HOSTNAMES.split(",")[0] }}

@ -37,8 +37,9 @@ os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN",
os.environ["ANTISPAM_MILTER_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_MILTER", "antispam:11332")
os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "imap:2525")
conf.jinja("/conf/rsyslog.conf", os.environ, "/etc/rsyslog.conf")
os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "imap:2525")
os.environ["POSTFIX_LOG_SYSLOG"] = os.environ.get("POSTFIX_LOG_SYSLOG","disabled")
for postfix_file in glob.glob("/conf/*.cf"):
conf.jinja(postfix_file, os.environ, os.path.join("/etc/postfix", os.path.basename(postfix_file)))
@ -64,8 +65,10 @@ if "RELAYUSER" in os.environ:
conf.jinja("/conf/sasl_passwd", os.environ, path)
os.system("postmap {}".format(path))
# Start rsyslog
os.system("/usr/sbin/rsyslogd -n &")
if os.environ["POSTFIX_LOG_SYSLOG"]=="local":
# Configure and start local rsyslog server
conf.jinja("/conf/rsyslog.conf", os.environ, "/etc/rsyslog.conf")
os.system("/usr/sbin/rsyslogd -n &")
# Run Podop and Postfix
multiprocessing.Process(target=start_podop).start()

@ -190,3 +190,15 @@ When using ``*_ADDRESS``, the hostnames must be full-qualified hostnames. Otherw
resolve the hostnames.
Maillog setitngs
----------------
By default, all services log directly to stdout/stderr. Logs can be collected by any docker log processing solution.
In some situations, a separate mail log is required (e.g. for legal reasons). Postfix can be configured to write the logs to a
syslog server that stores the log files to a volume. It can be configured by the following options:
- ``POSTFIX_LOG_SYSLOG``: (default: ``disabled``) set to ``local`` to enable a local syslog server for postfix
- ``POSTFIX_LOG_FILE``: The file to log the maillog to

Loading…
Cancel
Save