From: Andrew Lewis Date: Wed, 1 Sep 2021 11:56:59 +0000 (+0200) Subject: [Minor] rspamd_stats: support rescoring symbols X-Git-Tag: 3.1~202^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F3874%2Fhead;p=rspamd.git [Minor] rspamd_stats: support rescoring symbols --- diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index b0084c93a..e90524d20 100755 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -14,6 +14,7 @@ my @symbols_exclude; my @symbols_bidirectional; my @symbols_groups; my @symbols_ignored; +my %symbols_mult; my %groups; my $reject_score = 15.0; my $junk_score = 6.0; @@ -47,6 +48,7 @@ GetOptions( "ignore=s@" => \@symbols_ignored, "group|g=s@" => \@symbols_groups, "log|l=s" => \$log_file, + "mult=s" => \%symbols_mult, "alpha-score|alpha|a=f" => \$diff_alpha, "correlations|c" => \$correlations, "nrelated=i" => \$nrelated, @@ -427,7 +429,7 @@ sub ProcessRelated { next if IsIgnored($sym_name); if ($2) { - $sym_score = $3 * 1.0; + $sym_score = $3 * ($symbols_mult{$sym_name} or 1.0); if ( abs($sym_score) < $diff_alpha ) { next; @@ -549,7 +551,7 @@ sub ProcessLog { my $orig_name = $sym_name; if ($2) { - $sym_score = $3 * 1.0; + $sym_score = $3 * ($symbols_mult{$sym_name} or 1.0); if ( abs($sym_score) < $diff_alpha ) { next; @@ -868,6 +870,7 @@ rspamd_stats [options] [--symbol=SYM1 [--symbol=SYM2...]] [--log file] --exclude-logs=integer number of latest logs to exclude (0 by default) --json print json output instead of human readable --help brief help message + --mult=sym=number multiply symbol score --man full documentation =head1 OPTIONS @@ -932,6 +935,10 @@ Select log entries before this time. Format: C (can be trun with B<--start> select entries between B<--start> and B<--end>. The omitted date defaults to the current date if you supply the time. +=item B<--mult=symbol=number> + +Multiplies score for the named symbol by the provided multiplier. + =item B<--help> Print a brief help message and exits.