| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Log::Saftpresse::Plugin::Postfix; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1458
|
use Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: plugin to parse analyse postfix logging |
|
6
|
|
|
|
|
|
|
our $VERSION = '1.6'; # VERSION |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Log::Saftpresse::Plugin'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'saftsumm_mode' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'message_detail' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
14
|
|
|
|
|
|
|
has 'smtpd_warn_detail' => ( is => 'rw', isa => 'Int', default => 0 ); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'reject_detail' => ( is => 'rw', isa => 'Int', default => 0 ); |
|
17
|
|
|
|
|
|
|
has 'bounce_detail' => ( is => 'rw', isa => 'Int', default => 0 ); |
|
18
|
|
|
|
|
|
|
has 'deferred_detail' => ( is => 'rw', isa => 'Int', default => 0 ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'ignore_case' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
21
|
|
|
|
|
|
|
has 'rej_add_from' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'extended' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'uucp_mung' => ( is => 'rw', isa => 'Bool', default => 0 ); |
|
26
|
|
|
|
|
|
|
has 'verp_mung' => ( is => 'rw', isa => 'Int', default => 0 ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'tls_stats' => ( is => 'rw', isa => 'Bool', default => 1 ); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Role::CounterUtils'; |
|
31
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Role::Tracking'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Service'; |
|
34
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::QueueID'; |
|
35
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Messages'; |
|
36
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Rejects'; |
|
37
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Recieved'; |
|
38
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Delivered'; |
|
39
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Smtp'; |
|
40
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Smtpd'; |
|
41
|
|
|
|
|
|
|
with 'Log::Saftpresse::Plugin::Postfix::Tls'; |
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
5202
|
use Time::Piece; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub process { |
|
46
|
0
|
|
|
0
|
|
|
my ( $self, $stash, $notes ) = @_; |
|
47
|
0
|
|
|
|
|
|
my $program = $stash->{'program'}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
0
|
|
|
|
if( ! defined $program || $program !~ /^postfix\// ) { |
|
50
|
0
|
|
|
|
|
|
return; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->get_tracking_id('pid', $stash, $notes); |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->process_service( $stash, $notes ); |
|
56
|
0
|
0
|
|
|
|
|
if( ! defined $stash->{'service'} ) { |
|
57
|
0
|
|
|
|
|
|
return; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
0
|
|
|
|
|
|
$self->process_queueid( $stash, $notes ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->process_messages( $stash, $notes ); |
|
62
|
0
|
|
|
|
|
|
$self->process_rejects( $stash, $notes ); |
|
63
|
0
|
|
|
|
|
|
$self->process_recieved( $stash, $notes ); |
|
64
|
0
|
|
|
|
|
|
$self->process_delivered( $stash, $notes ); |
|
65
|
0
|
|
|
|
|
|
$self->process_smtp( $stash, $notes ); |
|
66
|
0
|
|
|
|
|
|
$self->process_smtpd( $stash, $notes ); |
|
67
|
0
|
0
|
|
|
|
|
if( $self->tls_stats ) { |
|
68
|
0
|
|
|
|
|
|
$self->process_tls( $stash, $notes ); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding UTF-8 |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Log::Saftpresse::Plugin::Postfix - plugin to parse analyse postfix logging |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 VERSION |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
version 1.6 |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 Description |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This plugin parses and analyzes postfix logging. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 Synopsis |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
<Plugin postfix> |
|
97
|
|
|
|
|
|
|
module = "postfix" |
|
98
|
|
|
|
|
|
|
</Plugin> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 Options |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item saftsumm_mode (default: 0) |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
If enabled the plugin will generate additional counters for per_hr, |
|
107
|
|
|
|
|
|
|
per_wdays and per_day values required for saftsumm output. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item message_detail (default: 0) |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
By default the plugin will trimm messages used by deferred_detail, |
|
112
|
|
|
|
|
|
|
smtpd_warn_detail and reject_detail. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
If enabled the full message will be used instead of the trimmed string. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item smtpd_warn_detail (default: 0) |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Enable generation of counters for smtpd warning messages. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item reject_detail (default: 0) |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Enable generation of counters per reject message. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item bounce_detail (default: 0) |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Enable generation of counters per bounce message. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item deferred_detail (default: 0) |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Enable generation of counters per deferral reason. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item ignore_case (default: 0) |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Enable to ignore case in addresses. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This will lower case all addresses. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item rej_add_from (default: 0) |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Include from address in reject messages statistics generated |
|
141
|
|
|
|
|
|
|
by reject_detail. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item extended (default: 0) |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Remember From: address across log lines. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
TODO: check what it really does. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item uucp_mung (default: 0) |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Convert uucp addresses. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item verp_mung (default: 0) |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Replace VERPs with placeholder. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item tls_stats (default: 1) |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Enable/disable TLS statistics. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 Input |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This plugin expects a log line with |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
program => /^postfix/ |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
and log messages generate by the postfix MTA in 'message'. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 Output |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The plugin will add the following fields if applicable: |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
* size |
|
176
|
|
|
|
|
|
|
* from |
|
177
|
|
|
|
|
|
|
* to |
|
178
|
|
|
|
|
|
|
* relay |
|
179
|
|
|
|
|
|
|
* delay |
|
180
|
|
|
|
|
|
|
* status |
|
181
|
|
|
|
|
|
|
* forwarded |
|
182
|
|
|
|
|
|
|
* postfix_level |
|
183
|
|
|
|
|
|
|
* queue_id |
|
184
|
|
|
|
|
|
|
* client_host |
|
185
|
|
|
|
|
|
|
* client_ip |
|
186
|
|
|
|
|
|
|
* reject_type |
|
187
|
|
|
|
|
|
|
* reject_reason |
|
188
|
|
|
|
|
|
|
* connection_time |
|
189
|
|
|
|
|
|
|
* client |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 Counters |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The plugin generates the following counters: |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
<host>.conn.total |
|
196
|
|
|
|
|
|
|
<host>.conn.per_domain.<domain> |
|
197
|
|
|
|
|
|
|
<host>.conn.busy.total |
|
198
|
|
|
|
|
|
|
<host>.conn.busy.per_domain.<domain> |
|
199
|
|
|
|
|
|
|
<host>.incoming.total |
|
200
|
|
|
|
|
|
|
<host>.reject.total.reject |
|
201
|
|
|
|
|
|
|
<host>.bounced.total |
|
202
|
|
|
|
|
|
|
<host>.recieved.by_sender.<sender> |
|
203
|
|
|
|
|
|
|
<host>.recieved.by_domain.<domain> |
|
204
|
|
|
|
|
|
|
<host>.recieved.total |
|
205
|
|
|
|
|
|
|
<host>.recieved.size.by_sender.<sender> |
|
206
|
|
|
|
|
|
|
<host>.recieved.size.by_domain.<domain> |
|
207
|
|
|
|
|
|
|
<host>.recieved.size.total |
|
208
|
|
|
|
|
|
|
<host>.tls_msg.smtpd.cipher.<tls_cipher> |
|
209
|
|
|
|
|
|
|
<host>.tls_msg.smtpd.keylen.<tls_keylen> |
|
210
|
|
|
|
|
|
|
<host>.tls_msg.smtpd.total |
|
211
|
|
|
|
|
|
|
<host>.tls_msg.smtpd.level.<tls_level> |
|
212
|
|
|
|
|
|
|
<host>.tls_msg.smtpd.proto.<tls_version> |
|
213
|
|
|
|
|
|
|
<host>.tls_msg.smtp.cipher.<tls_cipher> |
|
214
|
|
|
|
|
|
|
<host>.tls_msg.smtp.keylen.<tls_keylen> |
|
215
|
|
|
|
|
|
|
<host>.tls_msg.smtp.total |
|
216
|
|
|
|
|
|
|
<host>.tls_msg.smtp.level.<tls_level> |
|
217
|
|
|
|
|
|
|
<host>.tls_msg.smtp.proto.<tls_procol> |
|
218
|
|
|
|
|
|
|
<host>.deferred.max_delay.by_domain.<domain> |
|
219
|
|
|
|
|
|
|
<host>.deferred.by_domain.<domain> |
|
220
|
|
|
|
|
|
|
<host>.deferred.total |
|
221
|
|
|
|
|
|
|
<host>.tls_conn.smtpd.cipher.<tls_cipher> |
|
222
|
|
|
|
|
|
|
<host>.tls_conn.smtpd.keylen.<tls_keylen> |
|
223
|
|
|
|
|
|
|
<host>.tls_conn.smtpd.total |
|
224
|
|
|
|
|
|
|
<host>.tls_conn.smtpd.level.<tls_level> |
|
225
|
|
|
|
|
|
|
<host>.tls_conn.smtpd.proto.<tls_proto> |
|
226
|
|
|
|
|
|
|
<host>.tls_conn.smtp.cipher.<tls_cipher> |
|
227
|
|
|
|
|
|
|
<host>.tls_conn.smtp.keylen.<tls_keylen> |
|
228
|
|
|
|
|
|
|
<host>.tls_conn.smtp.total |
|
229
|
|
|
|
|
|
|
<host>.tls_conn.smtp.level.<tls_level> |
|
230
|
|
|
|
|
|
|
<host>.tls_conn.smtp.proto.<tls_proto> |
|
231
|
|
|
|
|
|
|
<host>.sent.delay.by_domain.<domain> |
|
232
|
|
|
|
|
|
|
<host>.sent.max_delay.by_domain.<domain> |
|
233
|
|
|
|
|
|
|
<host>.sent.by_domain.<domain> |
|
234
|
|
|
|
|
|
|
<host>.sent.total |
|
235
|
|
|
|
|
|
|
<host>.sent.size.by_domain.<domain> |
|
236
|
|
|
|
|
|
|
<host>.sent.size.total |
|
237
|
|
|
|
|
|
|
<host>.sent.size.by_rcpt.<recipient> |
|
238
|
|
|
|
|
|
|
<host>.sent.by_rcpt.<recipient> |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 AUTHOR |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
This is free software, licensed under: |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=cut |