Skip to content

Commit e246cf4

Browse files
committed
Replace POSTFIX_TIME_UNIT with a named capture
1 parent b8734bd commit e246cf4

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

postfix.grok

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ POSTFIX_STATUS_CODE_ENHANCED \d\.\d+\.\d+
1717
POSTFIX_DNSBL_MESSAGE Service unavailable; .* \[%{GREEDYDATA:postfix_status_data}\] %{GREEDYDATA:postfix_status_message};
1818
POSTFIX_PS_ACCESS_ACTION (DISCONNECT|DENYLISTED|BLACKLISTED|ALLOWLISTED|WHITELISTED|ALLOWLIST VETO|WHITELIST VETO|PASS NEW|PASS OLD)
1919
POSTFIX_PS_VIOLATION (BARE NEWLINE|COMMAND (TIME|COUNT|LENGTH) LIMIT|COMMAND PIPELINING|DNSBL|HANGUP|NON-SMTP COMMAND|PREGREET)
20-
POSTFIX_TIME_UNIT %{NUMBER}[smhd]
2120
POSTFIX_KEYVALUE_DATA [\w-]+=[^;]*
2221
POSTFIX_KEYVALUE %{POSTFIX_QUEUEID:postfix_queueid}: %{POSTFIX_KEYVALUE_DATA:postfix_keyvalue_data}
2322

@@ -88,7 +87,7 @@ POSTFIX_DNSBLOG_LISTING addr %{IP:postfix_client_ip} listed by domain %{HOSTNAME
8887
POSTFIX_TLSPROXY_CONN (DIS)?CONNECT( from)? %{POSTFIX_CLIENT}
8988

9089
# anvil patterns
91-
POSTFIX_ANVIL_CONN_RATE statistics: max connection rate %{NUMBER:postfix_anvil_conn_rate}/%{POSTFIX_TIME_UNIT:postfix_anvil_conn_period} for \(%{DATA:postfix_service}:(%{IP_UNKNOWN:postfix_client_ip_unknown}|%{IP:postfix_client_ip})\) at %{SYSLOGTIMESTAMP:postfix_anvil_timestamp}
90+
POSTFIX_ANVIL_CONN_RATE statistics: max connection rate %{NUMBER:postfix_anvil_conn_rate}/(?<postfix_anvil_conn_period>\d+[smhd]) for \(%{DATA:postfix_service}:(%{IP_UNKNOWN:postfix_client_ip_unknown}|%{IP:postfix_client_ip})\) at %{SYSLOGTIMESTAMP:postfix_anvil_timestamp}
9291
POSTFIX_ANVIL_CONN_CACHE statistics: max cache size %{NUMBER:postfix_anvil_cache_size} at %{SYSLOGTIMESTAMP:postfix_anvil_timestamp}
9392
POSTFIX_ANVIL_CONN_COUNT statistics: max connection count %{NUMBER:postfix_anvil_conn_count} for \(%{DATA:postfix_service}:(%{IP_UNKNOWN:postfix_client_ip_unknown}|%{IP:postfix_client_ip})\) at %{SYSLOGTIMESTAMP:postfix_anvil_timestamp}
9493

test/anvil_0005.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pattern: ^%{POSTFIX_ANVIL}$
2-
data: "statistics: max connection rate 1/60s for (smtpd:2604:8d00:0:1::3) at Oct 26 17:46:59"
2+
data: "statistics: max connection rate 1/5m for (smtpd:2604:8d00:0:1::3) at Oct 26 17:46:59"
33
results:
44
postfix_anvil_conn_rate: 1
5-
postfix_anvil_conn_period: 60s
5+
postfix_anvil_conn_period: 5m
66
postfix_service: smtpd
77
postfix_client_ip: 2604:8d00:0:1::3
88
postfix_anvil_timestamp: Oct 26 17:46:59

test/anvil_0007.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pattern: ^%{POSTFIX_ANVIL}$
2-
data: "statistics: max connection rate 1/60s for (127.0.0.1:2525:127.0.0.1) at Oct 26 18:13:50"
2+
data: "statistics: max connection rate 1/2h for (127.0.0.1:2525:127.0.0.1) at Oct 26 18:13:50"
33
results:
44
postfix_anvil_conn_rate: 1
5-
postfix_anvil_conn_period: 60s
5+
postfix_anvil_conn_period: 2h
66
postfix_service: 127.0.0.1:2525
77
postfix_client_ip: 127.0.0.1
88
postfix_anvil_timestamp: Oct 26 18:13:50

test/anvil_0009.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pattern: ^%{POSTFIX_ANVIL}$
2-
data: "statistics: max connection rate 1/60s for (smtp:unknown) at Sep 7 07:14:19"
2+
data: "statistics: max connection rate 1/7d for (smtp:unknown) at Sep 7 07:14:19"
33
results:
44
postfix_anvil_conn_rate: 1
5-
postfix_anvil_conn_period: 60s
5+
postfix_anvil_conn_period: 7d
66
postfix_service: smtp
77
postfix_client_ip_unknown: unknown
88
postfix_anvil_timestamp: Sep 7 07:14:19

0 commit comments

Comments
 (0)