]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Warn when symbols are filtered by alpha_score
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 11 Feb 2026 09:12:10 +0000 (09:12 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 11 Feb 2026 09:12:10 +0000 (09:12 +0000)
lualib/rspamadm/logstats.lua

index 332cc3d78f1b6d72531e8c5ee1d754a11defb971..b5749dfff3b90568deacd990686bf4356977c524 100644 (file)
@@ -271,6 +271,7 @@ local function handler(args)
   local total_spam = 0
   local total_junk = 0
   local sym_res = {}
+  local alpha_filtered = {}
   local actions = {}
   local timeStamp = {}
   local scanTime = { max = 0, total = 0 }
@@ -356,6 +357,7 @@ local function handler(args)
           if caps[4] then
             sym_score = (tonumber(tostring(caps[4])) or 0) * (symbols_mult[sym_name] or 1.0)
             if math.abs(sym_score) < diff_alpha then
+              alpha_filtered[sym_name] = (alpha_filtered[sym_name] or 0) + 1
               goto continue_sym
             end
             local bm = bidir_match[sym_name]
@@ -613,6 +615,16 @@ local function handler(args)
       end
     end
 
+    if next(alpha_filtered) then
+      io.write(string.format(
+        "\nWARNING: the following symbols were found but ignored" ..
+        " due to score < alpha_score (%.2f):\n", diff_alpha))
+      for sym, count in pairs(alpha_filtered) do
+        io.write(string.format("  %s: %d hit(s)\n", sym, count))
+      end
+      io.write("Use --alpha-score 0 to include them.\n")
+    end
+
     io.write(string.format("\n=== Summary %s\nMessages scanned: %d",
       string.rep('=', 68), total))
     if timeStamp['start'] then