line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Saftpresse::Plugin::Postfix::Recieved; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1753
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: plugin to gather postfix recieved messages statistics |
6
|
|
|
|
|
|
|
our $VERSION = '1.6'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4714
|
use Log::Saftpresse::Plugin::Postfix::Utils qw( postfix_remote ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
511
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub process_recieved { |
11
|
0
|
|
|
0
|
0
|
|
my ( $self, $stash, $notes ) = @_; |
12
|
0
|
|
|
|
|
|
my $service = $stash->{'service'}; |
13
|
0
|
|
|
|
|
|
my $message = $stash->{'message'}; |
14
|
0
|
|
|
|
|
|
my $qid = $stash->{'queue_id'}; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
0
|
|
|
|
if( $service eq 'smtpd' && |
|
|
0
|
0
|
|
|
|
|
17
|
|
|
|
|
|
|
$message =~ /client=(.+?)(,|$)/ ) { |
18
|
0
|
|
|
|
|
|
my ( $host, $addr ) = postfix_remote( $1 ); |
19
|
0
|
|
|
|
|
|
$stash->{'client_host'} = $host; |
20
|
0
|
|
|
|
|
|
$stash->{'client_ip'} = $addr; |
21
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'total'); |
22
|
0
|
0
|
|
|
|
|
if( $self->saftsumm_mode ) { |
23
|
0
|
|
|
|
|
|
$self->incr_per_time_one( $stash ); |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
$notes->set('client-'.$qid => $host); |
26
|
0
|
0
|
|
|
|
|
if( $message =~ /orig_queue_id=(.+?)(,|$)/) { |
27
|
0
|
|
|
|
|
|
$stash->{'orig_queue_id'} = $1; |
28
|
0
|
|
|
|
|
|
$self->get_tracking_id('queue_id', $stash, $notes, $1); |
29
|
0
|
|
|
|
|
|
$self->set_tracking_id('pid', $stash, $notes); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
$self->set_tracking_id('queue_id', $stash, $notes); |
32
|
|
|
|
|
|
|
} elsif( $service eq 'pickup' && |
33
|
|
|
|
|
|
|
$message =~ /(sender|uid)=/ ) { |
34
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'total'); |
35
|
0
|
0
|
|
|
|
|
if( $self->saftsumm_mode ) { |
36
|
0
|
|
|
|
|
|
$self->incr_per_time_one( $stash ); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
$notes->set('client-'.$qid => 'pickup'); |
39
|
0
|
|
|
|
|
|
$self->set_tracking_id('queue_id', $stash, $notes); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub incr_per_time_one { |
46
|
0
|
|
|
0
|
0
|
|
my ( $self, $stash ) = @_; |
47
|
0
|
|
|
|
|
|
my $time = $stash->{'time'}; |
48
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'per_hr', $time->hour ); |
49
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'per_mday', $time->mday ); |
50
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'per_wday', $time->wday ); |
51
|
0
|
|
|
|
|
|
$self->incr_host_one( $stash, 'incoming', 'per_day', $time->ymd ); |
52
|
0
|
|
|
|
|
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=encoding UTF-8 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Log::Saftpresse::Plugin::Postfix::Recieved - plugin to gather postfix recieved messages statistics |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 VERSION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
version 1.6 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This is free software, licensed under: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |