Skip to content

Commit 0529d69

Browse files
committed
Add pattern to extract warnings from postfix-script loglines
1 parent 232fa22 commit 0529d69

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

50-filter-postfix.conf

+7
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ filter {
168168
tag_on_failure => [ "_grok_postfix_postmap_nomatch" ]
169169
add_tag => [ "_grok_postfix_success" ]
170170
}
171+
} else if [program] =~ /^postfix.*\/postfix-script$/ {
172+
grok {
173+
patterns_dir => "/etc/logstash/patterns.d"
174+
match => [ "message", "^%{POSTFIX_SCRIPT}$" ]
175+
tag_on_failure => [ "_grok_postfix_script_nomatch" ]
176+
add_tag => [ "_grok_postfix_success" ]
177+
}
171178
} else if [program] =~ /^postfix.*/ {
172179
mutate {
173180
add_tag => [ "_grok_postfix_program_nomatch" ]

postfix.grok

+1
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,4 @@ POSTFIX_VIRTUAL %{POSTFIX_SMTP_DELIVERY}
138138
POSTFIX_ERROR %{POSTFIX_ERROR_ANY}
139139
POSTFIX_POSTSUPER %{POSTFIX_POSTSUPER_ACTION}|%{POSTFIX_POSTSUPER_SUMMARY}
140140
POSTFIX_POSTMAP %{POSTFIX_WARNING}
141+
POSTFIX_SCRIPT %{POSTFIX_WARNING}

test/script_0001.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pattern: ^%{POSTFIX_SCRIPT}$
2+
data: "warning: symlink leaves directory: /etc/postfix/./makedefs.out"
3+
results:
4+
postfix_message_level: warning
5+
postfix_message: "symlink leaves directory: /etc/postfix/./makedefs.out"

0 commit comments

Comments
 (0)