log rotation in maxking-docker-version
Hey there, while checking some logs I was realising that there is no log rotation and some of them piled up to 5GB over the past year(s). Does anybody know how to activate it (if it's possible) or ...
Ok, I found a clue and it's still open :-) https://github.com/maxking/docker-mailman/issues/535 -> does anybody have a different approach?
Regards, Jens.
Question in general: shall I put my questions regarding docker-version on Github or is it ok on this list?
e.g.: now realised, that all requests are doubled, all errors, all GET-requests ... this cannot be right and probably some misconfiguration :-( would love to dig deeper and just ask myself where.
Am 26.08.23 um 21:57 schrieb Jens Günther:
Hey there, while checking some logs I was realising that there is no log rotation and some of them piled up to 5GB over the past year(s). Does anybody know how to activate it (if it's possible) or ...
Ok, I found a clue and it's still open :-) https://github.com/maxking/docker-mailman/issues/535 -> does anybody have a different approach?
Regards, Jens.
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
This message sent to jens.guenther@posteo.de
Jens Günther writes:
Question in general: shall I put my questions regarding docker-version on Github or is it ok on this list?
Executive summary: docker issues are specialized, just post here.
Details for the curious: Issues that only affect the docker version are going to be based on (1) network connectivity issues between the containers and (2) stuff like logging configuration where files are stored on the physical host, which has to do log rotation, but mailman lives in a container, so when logrotate does its thing it has to jump through a few extra hoops to tell mailman to reopen its log streams. Those are probably best addressed to the docker-version issue tracker on GitHub.
e.g.: now realised, that all requests are doubled, all errors, all GET-requests ... this cannot be right and probably some misconfiguration :-( would love to dig deeper and just ask myself where.
I think it's in settings.py there's a log stream that both has a file handler and is set to propagate to root, which goes to the same file. Turn off the propagation. Find the stanza by searching for "LOGGING" if I remember correctly.
Jens Günther writes:
Hey there, while checking some logs I was realising that there is no log rotation and some of them piled up to 5GB over the past year(s). Does anybody know how to activate it (if it's possible) or ...
Ok, I found a clue and it's still open :-) https://github.com/maxking/docker-mailman/issues/535 -> does anybody have a different approach?
I find it hard to believe that lack of logrotate configuration didn't get fixed pretty quickly. More likely it's a probably with core: https://gitlab.com/mailman/mailman/-/issues/931 This is the patch which has WFM for quite a while. (It's the same new code as 931, but 931 doesn't show the code removed.) I'll try to get a MR submitted this week but it won't show up in a release for a while. Note this patch is against 3.3.6; I haven't checked if there are changes to logging.py since that release. diff --git a/src/mailman/core/logging.py b/src/mailman/core/logging.py index 04847b318..68506a165 100644 --- a/src/mailman/core/logging.py +++ b/src/mailman/core/logging.py @@ -113,14 +113,20 @@ def _init_logger(propagate, sub_name, log, logger_config): if propagate is None else propagate) # Set the logger's level. log.setLevel(as_log_level(logger_config.level)) - # Create a formatter for this logger, then a handler, and link the - # formatter to the handler. - formatter = logging.Formatter(fmt=log_format, datefmt=log_datefmt) - path_str = logger_config.path - path_abs = os.path.normpath(os.path.join(config.LOG_DIR, path_str)) - handler = ReopenableFileHandler(sub_name, path_abs) - _handlers[sub_name] = handler - handler.setFormatter(formatter) + # There are two alternative approaches to registering handlers described + # in https://gitlab.com/mailman/mailman/-/issues/931#note_1411199556. + # Both are more or less incompatible with the get_handler() utility + # defined below. + handler = _handlers.get(sub_name) + if handler is None: + # Create a formatter for this logger, then a handler, and link the + # formatter to the handler. + formatter = logging.Formatter(fmt=log_format, datefmt=log_datefmt) + path_str = logger_config.path + path_abs = os.path.normpath(os.path.join(config.LOG_DIR, path_str)) + handler = ReopenableFileHandler(sub_name, path_abs) + handler.setFormatter(formatter) + _handlers[sub_name] = handler log.addHandler(handler)
participants (2)
-
Jens Günther
-
Stephen J. Turnbull