From: Frank Brehm Date: Wed, 10 Apr 2024 12:43:24 +0000 (+0200) Subject: Parsing fo rBounce-Id in class PostfixLogfileParser X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=5191cb416f08f9a5a06029155da2d08aef2cc61e;p=pixelpark%2Fpp-admin-tools.git Parsing fo rBounce-Id in class PostfixLogfileParser --- diff --git a/lib/pp_admintools/handler/pflogparse.py b/lib/pp_admintools/handler/pflogparse.py index 9ae7ee8..97c0257 100644 --- a/lib/pp_admintools/handler/pflogparse.py +++ b/lib/pp_admintools/handler/pflogparse.py @@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__) _ = XLATOR.gettext ngettext = XLATOR.ngettext -__version__ = '0.4.1' +__version__ = '0.4.2' # ============================================================================= @@ -61,6 +61,8 @@ class PostfixLogfileParser(HandlingObject): re_dis_mail = re.compile(r'\smail=(\d+)', re.IGNORECASE) re_message_id = re.compile(r'message-id=(\S+)', re.IGNORECASE) + re_bounce_id = re.compile( + r'sender\s+non-delivery\s+notification:\s+(?P\S+)', re.IGNORECASE) re_from_addr = re.compile( r'^\s*from=<(?P[^>]*)>,\s+size=(?P\d+),\s+nrcpt=(?P\d+)', @@ -320,6 +322,14 @@ class PostfixLogfileParser(HandlingObject): if smtpd_done: return + if command == 'postfix/bounce': + m = self.re_bounce_id.match(message) + if m: + bid = m['bounce_id'].strip() + if bid: + self.chain[postfix_id].add_bounce_id(bid) + return + if self.verbose > 1: msg = f'Evaluating further entry of {command!r} for Postfix Id {postfix_id!r}: ' LOG.debug(msg + message)