From 5191cb416f08f9a5a06029155da2d08aef2cc61e Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 10 Apr 2024 14:43:24 +0200 Subject: [PATCH] Parsing fo rBounce-Id in class PostfixLogfileParser --- lib/pp_admintools/handler/pflogparse.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) -- 2.39.5