aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-05-12 11:04:04 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-05-12 11:04:04 +0100
commit2b00750d9ab32004efd56e11a55a673ac8844684 (patch)
tree35e1eb98a7865d340d91f0c854a2fe214d6b129d /lualib/rspamadm
parent862123f88a73517b4c994b66dd8a5263f80a54dd (diff)
downloadrspamd-2b00750d9ab32004efd56e11a55a673ac8844684.tar.gz
rspamd-2b00750d9ab32004efd56e11a55a673ac8844684.zip
[Fix] More fixes to fuzzystat
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/fuzzy_stat.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/lualib/rspamadm/fuzzy_stat.lua b/lualib/rspamadm/fuzzy_stat.lua
index 47b780a09..85af32d28 100644
--- a/lualib/rspamadm/fuzzy_stat.lua
+++ b/lualib/rspamadm/fuzzy_stat.lua
@@ -57,10 +57,14 @@ local function add_data(target, src)
end
local function print_num(num)
- if opts['n'] or opts['number'] then
- return tostring(num)
+ if num then
+ if opts['n'] or opts['number'] then
+ return tostring(num)
+ else
+ return rspamd_util.humanize_number(num)
+ end
else
- return rspamd_util.humanize_number(num)
+ return 'na'
end
end
@@ -301,8 +305,10 @@ return function(args, res)
if key_stat.flags then
print('')
print('\tFlags stat:')
- for flag,v in ipairs(key_stat.flags) do
- print(string.format('\t%s', flag))
+ for flag,v in pairs(key_stat.flags) do
+ print(string.format('\t[%s]:', flag))
+ -- Remove irrelevant fields
+ v.checked = nil
print_stat(v, '\t\t')
print('')
end
@@ -331,7 +337,7 @@ return function(args, res)
print('')
print('IPs statistics:')
- local sorted_ips = sort_hash_table(res_ips, opts)
+ local sorted_ips = sort_hash_table(res_ips, opts, 'ip')
for _, v in ipairs(sorted_ips) do
print(string.format('%s', v['ip']))
print_stat(v['data'], '\t')