1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-04 10:24:41 +02:00

access_logs are DEBUG on admin

This commit is contained in:
Florent Daigniere 2024-04-20 23:19:59 +02:00
parent da36ac0e92
commit 1d8f041b87
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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