Skip to content

Commit e17c04d

Browse files
authored
Replace single filters with a more generic one (#39)
helps with #32 helps with #37
1 parent 7f1fa82 commit e17c04d

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

filter-50-smtps.conf

+3-39
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
filter {
22
if [postfix][component] == "smtps" {
33

4-
# matches connect from and disconnect from
5-
# not very efficient to check every log this way
6-
# contributions with better checks are very welcome :-)
7-
if [message] =~ /connect from/ {
4+
if [message] =~ /from/ {
85
grok {
9-
match => ["message","(dis)?connect from %{HOSTNAME:[client][domain]}\[%{IP:[client][address]}\](%{GREEDYDATA:[@metadata][connectdetail]})?"]
6+
match => ["message","%{DATA:[postfix][connection]} from %{HOSTNAME:[client][domain]}\[%{IP:[client][address]}\](: %{GREEDYDATA:[postfix][detail]})?"]
107
id => "postfix_smtps_connect"
118
tag_on_failure => ["_grokparsefailure","postfix_smtps_connect_failed"]
129
add_field => {
@@ -15,21 +12,7 @@ filter {
1512
add_tag => "grokked"
1613
}
1714

18-
}
19-
20-
if [message] =~ /^lost connection after/ {
21-
grok {
22-
match => ["message","lost connection after %{WORD:[postfix][action]} from %{HOSTNAME:[client][domain]}\[%{IP:[client][address]}\]"]
23-
id => "postfix_smtps_lostconnection"
24-
tag_on_failure => ["_grokparsefailure","postfix_smtps_lostconnection"]
25-
add_field => {
26-
"[postfix][eventtype]" => "smtps_lostconnection"
27-
}
28-
add_tag => "grokked"
29-
}
30-
}
31-
32-
if [message] =~ /^warning: .*authentication failed/ {
15+
} else if [message] =~ /^warning: .*authentication failed/ {
3316
grok {
3417
match => ["message","warning: %{HOSTNAME:[client][domain]}\[%{IP:[client][address]}\]: %{GREEDYDATA:[postfix][detail]}"]
3518
id => "postfix_smtps_authenticationfailed"
@@ -40,24 +23,5 @@ filter {
4023
add_tag => "grokked"
4124
}
4225
}
43-
44-
if [message] =~ /^Anonymous TLS connection established from/ {
45-
grok {
46-
match => ["message","Anonymous TLS connection established from %{HOSTNAME:[client][domain]}\[%{IP:[client][address]}\]: %{GREEDYDATA:[postfix][detail]}"]
47-
id => "postfix_smtps_anontls"
48-
tag_on_failure => ["_grokparsefailure","postfix_smtps_anontls"]
49-
add_field => {
50-
"[postfix][eventtype]" => "smtps_anontls"
51-
}
52-
add_tag => "grokked"
53-
}
54-
}
55-
56-
if [@metadata][connectdetail] {
57-
kv {
58-
source => "[@metadata][connectdetail]"
59-
target => "[postfix]"
60-
}
61-
}
6226
}
6327
}

0 commit comments

Comments
 (0)