Skip to content

Commit

Permalink
Added support for postmaster bounces
Browse files Browse the repository at this point in the history
Also extract the bounce recipient and the boucne reason from the log message
  • Loading branch information
whyscream committed Jul 4, 2024
1 parent de15798 commit 2cdf1fa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion postfix.grok
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ POSTFIX_MASTER_START (daemon started|reload) -- version %{DATA:postfix_version},
POSTFIX_MASTER_EXIT terminating on signal %{INT:postfix_termination_signal}

# bounce patterns
POSTFIX_BOUNCE_NOTIFICATION %{POSTFIX_QUEUEID:postfix_queueid}: sender (non-delivery|delivery status|delay) notification: %{POSTFIX_QUEUEID:postfix_bounce_queueid}
POSTFIX_BOUNCE_NOTIFICATION %{POSTFIX_QUEUEID:postfix_queueid}: (?<postfix_bounce_recipient>(sender|postmaster)) (?<postfix_bounce_reason>(non-delivery|delivery status|delay)) notification: %{POSTFIX_QUEUEID:postfix_bounce_queueid}

# scache patterns
POSTFIX_SCACHE_LOOKUPS statistics: (address|domain) lookup hits=%{INT:postfix_scache_hits} miss=%{INT:postfix_scache_miss} success=%{INT:postfix_scache_success}%
Expand Down
2 changes: 2 additions & 0 deletions test/bounce_0001.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ data: "17CCA8044: sender non-delivery notification: ADD2F8052"
results:
postfix_queueid: 17CCA8044
postfix_bounce_queueid: ADD2F8052
postfix_bounce_recipient: sender
postfix_bounce_reason: non-delivery
2 changes: 2 additions & 0 deletions test/bounce_0002.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ data: "65AFB8B5: sender delivery status notification: 1DF35917"
results:
postfix_queueid: 65AFB8B5
postfix_bounce_queueid: 1DF35917
postfix_bounce_recipient: sender
postfix_bounce_reason: delivery status
2 changes: 2 additions & 0 deletions test/bounce_0003.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ data: "264FE1A18: sender delay notification: 0A87A1A08"
results:
postfix_queueid: 264FE1A18
postfix_bounce_queueid: 0A87A1A08
postfix_bounce_recipient: sender
postfix_bounce_reason: delay
7 changes: 7 additions & 0 deletions test/bounce_0004.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pattern: ^%{POSTFIX_BOUNCE}$
data: "482E4404AC8: postmaster non-delivery notification: 47335405A44"
results:
postfix_queueid: 482E4404AC8
postfix_bounce_queueid: 47335405A44
postfix_bounce_recipient: postmaster
postfix_bounce_reason: non-delivery

0 comments on commit 2cdf1fa

Please sign in to comment.