diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index 26a79791..444dacad 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -2,11 +2,6 @@ # General ############### -{% if POSTFIX_LOG_SYSLOG != "local" %} -# Logging configuration -maillog_file = /dev/stdout -{% endif %} - # Main domain and hostname mydomain = {{ DOMAIN }} myhostname = {{ HOSTNAMES.split(",")[0] }} diff --git a/core/postfix/start.py b/core/postfix/start.py index de97baf6..19b403db 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -82,15 +82,14 @@ if "RELAYUSER" in os.environ: conf.jinja("/conf/sasl_passwd", os.environ, path) os.system("postmap {}".format(path)) -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 &") - # Configure logrotate - if os.environ["POSTFIX_LOG_FILE"] != "": - conf.jinja("/conf/logrotate.conf", os.environ, "/etc/logrotate.d/postfix.conf") - if os.path.exists("/overrides/logrotate.conf"): - shutil.copyfile("/overrides/logrotate.conf", "/etc/logrotate.d/postfix.conf") +# Configure and start local rsyslog server +conf.jinja("/conf/rsyslog.conf", os.environ, "/etc/rsyslog.conf") +os.system("/usr/sbin/rsyslogd -n &") +# Configure logrotate +if os.environ["POSTFIX_LOG_FILE"] != "": + conf.jinja("/conf/logrotate.conf", os.environ, "/etc/logrotate.d/postfix.conf") + if os.path.exists("/overrides/logrotate.conf"): + shutil.copyfile("/overrides/logrotate.conf", "/etc/logrotate.d/postfix.conf") # Run Podop and Postfix multiprocessing.Process(target=start_podop).start() diff --git a/docs/configuration.rst b/docs/configuration.rst index 0709e37b..fba84c9a 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -268,9 +268,8 @@ Mail log settings By default, all services log directly to stdout/stderr. Logs can be collected by any docker log processing solution. Postfix writes the logs to a syslog server which logs to stdout. This is used to filter out messages from the healthcheck. -In some situations, a separate mail log is required (e.g. for legal reasons). The syslog server can be configured to write log files to a volume. It can be configured by the following options: +In some situations, a separate mail log is required (e.g. for legal reasons). The syslog server can be configured to write log files to a volume. It can be configured with the following option: -- ``POSTFIX_LOG_SYSLOG`` (default: ``local`` ): Set to ``local`` (default) to enable the syslog server. Set to ``disable`` to disable the syslog server. If disabled, Postfix will log directly to stdout and the healthcheck messages will not be filtered out. - ``POSTFIX_LOG_FILE``: The file to log the mail log to. When enabled, the syslog server will also log to stdout. When ``POSTFIX_LOG_FILE`` is enabled, the logrotate program will automatically rotate the logs every week and keep 52 logs. diff --git a/towncrier/newsfragments/1441.feature b/towncrier/newsfragments/1441.feature index ea2b721e..7704b2cb 100644 --- a/towncrier/newsfragments/1441.feature +++ b/towncrier/newsfragments/1441.feature @@ -1,9 +1,6 @@ -Introduces postfix logging via rsyslog with these features: +Introduces postfix logging via syslog with these features: - stdout logging still enabled - internal test request log messages (healthcheck) are filtered out by rsyslog - optional logging to file via POSTFIX_LOG_FILE env variable -To use it configure in mailu.env -- ``POSTFIX_LOG_SYSLOG``: (default: ``local``) set to ``local`` (Default) to enable a local syslog server for postfix. Set to ``disable``to disable. +To use logging to file configure in mailu.env - ``POSTFIX_LOG_FILE``: The file to log the mail log to -Not disabling POSTFIX_LOG_SYSLOG is recommended to get rid of internal healtcheck messages. -