Skip to content

Commit 296336f

Browse files
committed
Support for parsing the verify cache cleanup results
1 parent 86e4a89 commit 296336f

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

50-filter-postfix.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ filter {
175175
tag_on_failure => [ "_grok_postfix_script_nomatch" ]
176176
add_tag => [ "_grok_postfix_success" ]
177177
}
178+
} else if [program] =~ /^postfix.*\/verify$/ {
179+
grok {
180+
patterns_dir => "/etc/logstash/patterns.d"
181+
match => [ "message", "^%{POSTFIX_VERIFY}$" ]
182+
tag_on_failure => [ "_grok_postfix_verify_nomatch" ]
183+
add_tag => [ "_grok_postfix_success" ]
184+
}
178185
} else if [program] =~ /^postfix.*/ {
179186
mutate {
180187
add_tag => [ "_grok_postfix_program_nomatch" ]
@@ -270,6 +277,8 @@ filter {
270277
"postfix_size", "integer",
271278
"postfix_status_code", "integer",
272279
"postfix_termination_signal", "integer",
280+
"postfix_verify_cache_dropped", "integer",
281+
"postfix_verify_cache_retained", "integer",
273282

274283
# list of float fields
275284
"postfix_delay", "float",

postfix.grok

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ POSTFIX_TIME_UNIT %{NUMBER}[smhd]
2323
POSTFIX_KEYVALUE_DATA [\w-]+=[^;]*
2424
POSTFIX_KEYVALUE %{POSTFIX_QUEUEID:postfix_queueid}: %{POSTFIX_KEYVALUE_DATA:postfix_keyvalue_data}
2525
POSTFIX_WARNING_LEVEL (warning|fatal|info)
26+
POSTFIX_VERIFY_CLEANUP_TYPE (full|partial)
2627

2728
POSTFIX_TLSCONN (Anonymous|Trusted|Untrusted|Verified) TLS connection established (to %{POSTFIX_RELAY_INFO}|from %{POSTFIX_CLIENT_INFO}): %{DATA:postfix_tls_version} with cipher %{DATA:postfix_tls_cipher} \(%{DATA:postfix_tls_cipher_size} bits\)
2829
POSTFIX_TLSVERIFICATION certificate verification failed for %{POSTFIX_RELAY_INFO}: %{GREEDYDATA:postfix_tls_error}
@@ -117,6 +118,9 @@ POSTFIX_SCACHE_LOOKUPS statistics: (address|domain) lookup hits=%{INT:postfix_sc
117118
POSTFIX_SCACHE_SIMULTANEOUS statistics: max simultaneous domains=%{INT:postfix_scache_domains} addresses=%{INT:postfix_scache_addresses} connection=%{INT:postfix_scache_connection}
118119
POSTFIX_SCACHE_TIMESTAMP statistics: start interval %{SYSLOGTIMESTAMP:postfix_scache_timestamp}
119120

121+
# verify patterns
122+
POSTFIX_VERIFY_CACHE cache %{DATA} %{POSTFIX_VERIFY_CLEANUP_TYPE:postfix_verify_cleanup_type} cleanup: retained=%{INT:postfix_verify_cache_retained} dropped=%{INT:postfix_verify_cache_dropped} entries
123+
120124
# aggregate all patterns
121125
POSTFIX_SMTPD %{POSTFIX_SMTPD_CONNECT}|%{POSTFIX_SMTPD_DISCONNECT}|%{POSTFIX_SMTPD_LOSTCONN}|%{POSTFIX_SMTPD_NOQUEUE}|%{POSTFIX_SMTPD_PIPELINING}|%{POSTFIX_TLSCONN}|%{POSTFIX_WARNING}|%{POSTFIX_SMTPD_PROXY}|%{POSTFIX_KEYVALUE}
122126
POSTFIX_CLEANUP %{POSTFIX_CLEANUP_MESSAGEID}|%{POSTFIX_CLEANUP_MILTER}|%{POSTFIX_CLEANUP_PREPEND}|%{POSTFIX_WARNING}|%{POSTFIX_KEYVALUE}
@@ -143,3 +147,4 @@ POSTFIX_ERROR %{POSTFIX_ERROR_ANY}
143147
POSTFIX_POSTSUPER %{POSTFIX_POSTSUPER_ACTION}|%{POSTFIX_POSTSUPER_SUMMARY}
144148
POSTFIX_POSTMAP %{POSTFIX_WARNING}
145149
POSTFIX_SCRIPT %{POSTFIX_WARNING}
150+
POSTFIX_VERIFY %{POSTFIX_VERIFY_CACHE}

test/verify_0001.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pattern: ^%{POSTFIX_VERIFY}$
2+
data: "cache lmdb:/var/lib/postfix/verify_cache full cleanup: retained=724 dropped=6 entries"
3+
results:
4+
postfix_verify_cleanup_type: full
5+
postfix_verify_cache_retained: 724
6+
postfix_verify_cache_dropped: 6

test/verify_0002.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pattern: ^%{POSTFIX_VERIFY}$
2+
data: "cache ??????????????????????????????????? partial cleanup: retained=1 dropped=0 entries"
3+
results:
4+
postfix_verify_cleanup_type: partial
5+
postfix_verify_cache_retained: 1
6+
postfix_verify_cache_dropped: 0

0 commit comments

Comments
 (0)