]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] rspamd_stats: support rescoring symbols 3874/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 1 Sep 2021 11:56:59 +0000 (13:56 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 1 Sep 2021 14:37:12 +0000 (16:37 +0200)
utils/rspamd_stats.pl

index b0084c93a7658f7424cdda8e2d7ea9eb87e8b403..e90524d2039380be023041f19fa35bc44ca3f656 100755 (executable)
@@ -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<YYYY-MM-DD HH:MM:SS> (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.