Browse Source

[Minor] rspamd_stats: add actions totals

tags/1.5.0
Alexander Moisseev 7 years ago
parent
commit
44b94e247d
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      utils/rspamd_stats.pl

+ 12
- 8
utils/rspamd_stats.pl View File

@@ -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) {

Loading…
Cancel
Save