diff --git a/core/admin/mailu/__init__.py b/core/admin/mailu/__init__.py index 19731340..dc9dc97d 100644 --- a/core/admin/mailu/__init__.py +++ b/core/admin/mailu/__init__.py @@ -11,7 +11,14 @@ import logging import hmac class NoPingFilter(logging.Filter): + skipAccessLogs = False + + def __init__(self, filterAccessLogs=False): + self.skipAccessLogs = filterAccessLogs + def filter(self, record): + if self.skipAccessLogs and record.args['r'].endswith(' HTTP/1.1'): + return False if record.args['r'].endswith(' /ping HTTP/1.1'): return False if record.args['r'].endswith(' /internal/rspamd/local_domains HTTP/1.1'): @@ -24,7 +31,7 @@ class Logger(glogging.Logger): # Add filters to Gunicorn logger logger = logging.getLogger("gunicorn.access") - logger.addFilter(NoPingFilter()) + logger.addFilter(NoPingFilter(logger.getEffectiveLevel()>logging.DEBUG)) def create_app_from_config(config): """ Create a new application based on the given configuration diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 7c36a7ec..496a8324 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -178,7 +178,7 @@ REAL_IP_FROM={{ real_ip_from }} REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }} # Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET) -LOG_LEVEL=WARNING +LOG_LEVEL=INFO # Timezone for the Mailu containers. See this link for all possible values https://en.wikipedia.org/wiki/List_of_tz_database_time_zones TZ=Etc/UTC