| 1 | package Log::Saftpresse::Plugin::Postfix::Recieved; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: plugin to gather postfix recieved messages statistics | ||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.5'; # VERSION | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Log::Saftpresse::Plugin::Postfix::Utils qw( postfix_remote ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | sub process_recieved { | ||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | my ( $self, $stash, $notes ) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
process_recieved: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 12 | 0 | my $service = $stash->{'service'}; | |||||||||||||||||||||||||||||||
| 13 | 0 | my $message = $stash->{'message'}; | |||||||||||||||||||||||||||||||
| 14 | 0 | my $qid = $stash->{'queue_id'}; | |||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if( $service eq 'smtpd' && | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$service eq "smtpd" and $message =~ /client=(.+?)(,|$)/
MC/DC0%0/2
$service eq "smtpd" and $message =~ /client=(.+?)(,|$)/
$service eq "smtpd"
$message =~ /client=(.+?)(,|$)/
Truth table0%0/3
A and B
A= $service eq "smtpd"B= $message =~ /client=(.+?)(,|$)/
| |||||||||||||||||||||||||||||||||
| 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 | ▶ | if( $self->saftsumm_mode ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 23 | 0 | $self->incr_per_time_one( $stash ); | |||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||
| 25 | 0 | $notes->set('client-'.$qid => $host); | |||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if( $message =~ /orig_queue_id=(.+?)(,|$)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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' && | |||||||||||||||||||||||||||||||
|
Condition0%0/3
$service eq "pickup" and $message =~ /(sender|uid)=/
MC/DC0%0/2
$service eq "pickup" and $message =~ /(sender|uid)=/
$service eq "pickup"
$message =~ /(sender|uid)=/
Truth table0%0/3
A and B
A= $service eq "pickup"B= $message =~ /(sender|uid)=/
| |||||||||||||||||||||||||||||||||
| 33 | $message =~ /(sender|uid)=/ ) { | ||||||||||||||||||||||||||||||||
| 34 | 0 | $self->incr_host_one( $stash, 'incoming', 'total'); | |||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if( $self->saftsumm_mode ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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 | ▶ | my ( $self, $stash ) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
incr_per_time_one: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 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 | 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.5 | ||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||