aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-20 11:37:11 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-20 11:37:29 +0100
commit3f3a884e4563e53d6b9b6442ebe632522be6a37b (patch)
treeb2dd5c925887fb13add29c6e42a8108a2d8c3601 /utils
parentbf8f9c32e35f58d1da9ea4bf91b392bcff8f70c6 (diff)
downloadrspamd-3f3a884e4563e53d6b9b6442ebe632522be6a37b.tar.gz
rspamd-3f3a884e4563e53d6b9b6442ebe632522be6a37b.zip
[Minor] Add support of groups in rspamd_stats
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rspamd_stats.pl20
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,