Skip to content

Commit 232fa22

Browse files
committed
Add pattern to parse warnings from postfix/postmap
1 parent ab39dd3 commit 232fa22

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

50-filter-postfix.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ filter {
161161
tag_on_failure => [ "_grok_postfix_virtual_nomatch" ]
162162
add_tag => [ "_grok_postfix_success" ]
163163
}
164+
} else if [program] =~ /^postfix.*\/postmap$/ {
165+
grok {
166+
patterns_dir => "/etc/logstash/patterns.d"
167+
match => [ "message", "^%{POSTFIX_POSTMAP}$" ]
168+
tag_on_failure => [ "_grok_postfix_postmap_nomatch" ]
169+
add_tag => [ "_grok_postfix_success" ]
170+
}
164171
} else if [program] =~ /^postfix.*/ {
165172
mutate {
166173
add_tag => [ "_grok_postfix_program_nomatch" ]

postfix.grok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ POSTFIX_LOCAL %{POSTFIX_KEYVALUE}|%{POSTFIX_WARNING}
137137
POSTFIX_VIRTUAL %{POSTFIX_SMTP_DELIVERY}
138138
POSTFIX_ERROR %{POSTFIX_ERROR_ANY}
139139
POSTFIX_POSTSUPER %{POSTFIX_POSTSUPER_ACTION}|%{POSTFIX_POSTSUPER_SUMMARY}
140+
POSTFIX_POSTMAP %{POSTFIX_WARNING}

test/postmap_0001.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pattern: ^%{POSTFIX_POSTMAP}$
2+
data: "warning: /etc/postfix/conf.d/users.db: duplicate entry: \"xxx@yyy.com\""
3+
results:
4+
postfix_message_level: warning
5+
postfix_message: "/etc/postfix/conf.d/users.db: duplicate entry: \"xxx@yyy.com\""

0 commit comments

Comments
 (0)