diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rspamd_stats.pl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index 3a8affce1..39a3debc2 100755 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -12,6 +12,8 @@ use strict; my @symbols_search; my @symbols_exclude; my @symbols_bidirectional; +my @symbols_groups; +my %groups; my $reject_score = 15.0; my $junk_score = 6.0; my $diff_alpha = 0.1; @@ -41,6 +43,7 @@ GetOptions( "symbol|s=s@" => \@symbols_search, "symbol-bidir|S=s@" => \@symbols_bidirectional, "exclude|X=s@" => \@symbols_exclude, + "group|g=s@" => \@symbols_groups, "log|l=s" => \$log_file, "alpha-score|alpha|a=f" => \$diff_alpha, "correlations|c" => \$correlations, @@ -93,6 +96,18 @@ foreach my $s (@symbols_bidirectional) { push @symbols_search, $s unless grep /^$s$/, @symbols_search; } +# Deal with groups +my $group_id = 0; +foreach my $g (@symbols_groups) { + my @symbols = split /,/,$g; + my $group_name = "group$group_id"; + + foreach my $s (@symbols) { + $groups{$s} = $group_name; + push @symbols_search, $s unless grep /^$s$/, @symbols_search; + } +} + @symbols_search = '.*' unless @symbols_search; @@ -508,6 +523,11 @@ sub ProcessLog { push @sym_names, $sym_name; + if ($groups{$s}) { + # Replace with group + $sym_name = $groups{$s}; + } + if (!$sym_res{$sym_name}) { $sym_res{$sym_name} = { hits => 0, |