diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2016-12-07 19:44:12 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2016-12-07 19:44:12 +0300 |
commit | 44b94e247d1c719d9871a698fec27f67560ca5b3 (patch) | |
tree | 349c4e4c72fce6911f1d39b5e0db8bdbf4754f07 /utils/rspamd_stats.pl | |
parent | e53908532ab8a6ba470393d171fe0ee41ee6aaaf (diff) | |
download | rspamd-44b94e247d1c719d9871a698fec27f67560ca5b3.tar.gz rspamd-44b94e247d1c719d9871a698fec27f67560ca5b3.zip |
[Minor] rspamd_stats: add actions totals
Diffstat (limited to 'utils/rspamd_stats.pl')
-rw-r--r-- | utils/rspamd_stats.pl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index e1618d14d..b845964ff 100644 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -59,6 +59,7 @@ my %sym_res; my $rspamd_log; my $enabled = 0; +my %action; my %timeStamp; my %scanTime = ( max => 0, @@ -172,6 +173,8 @@ printf " [ %s / %s ] ", $timeStamp{'start'}, $timeStamp{'end'} if defined $timeStamp{'start'}; say ''; +printf "%11s: %d\n", $_, $action{$_} for sort keys %action; +say ''; printf "scan time min/avg/max = %.2f/%.2f/%.2f s ", $scanTime{'min'} / 1000, ($total) ? $scanTime{'total'} / $total / 1000 : undef, @@ -192,20 +195,21 @@ sub ProcessLog { if (/^.*rspamd_task_write_log.*$/) { $timeStamp{'end'} = join ' ', ( split /\s+/ )[ 0 .. 1 ]; - if ($_ !~ /\[(NaN|-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)\]\s+\[([^\]]+)\].+? time: (\d+\.\d+)ms real/) { + if ($_ !~ /\(([^()]+)\): \[(NaN|-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)\]\s+\[([^\]]+)\].+? time: (\d+\.\d+)ms real/) { #print "BAD: $_\n"; next; } $timeStamp{'start'} //= $timeStamp{'end'}; - $scanTime{'min'} = $4 - if ( !exists $scanTime{'min'} || $scanTime{'min'} > $4 ); - $scanTime{'max'} = $4 - if ( $scanTime{'max'} < $4 ); - $scanTime{'total'} += $4; + $scanTime{'min'} = $5 + if ( !exists $scanTime{'min'} || $scanTime{'min'} > $5 ); + $scanTime{'max'} = $5 + if ( $scanTime{'max'} < $5 ); + $scanTime{'total'} += $5; + $action{$1}++; $total ++; - my $score = $1 * 1.0; + my $score = $2 * 1.0; if ($score >= $reject_score) { $total_spam ++; @@ -215,7 +219,7 @@ sub ProcessLog { } # Symbols - my @symbols = split /(?:\{[^}]*\})?,/, $3; + my @symbols = split /(?:\{[^}]*\})?,/, $4; my @sym_names; foreach my $s (@symbols_search) { |