From 79052d53a490c8f1122f15e5e75465c6653d9b1a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 27 Jun 2016 18:16:11 +0100 Subject: [Feature] Allow to query storage about number of fuzzy hashes stored --- src/client/rspamc.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/client') diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 68c33472d..6c99f9984 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -910,10 +910,23 @@ rspamc_stat_output (FILE *out, ucl_object_t *obj) rspamd_printf_gstring (out_str, "Oversized chunks: %L\n", ucl_object_toint (ucl_object_lookup (obj, "chunks_oversized"))); /* Fuzzy */ - rspamd_printf_gstring (out_str, "Fuzzy hashes stored: %L\n", - ucl_object_toint (ucl_object_lookup (obj, "fuzzy_stored"))); - rspamd_printf_gstring (out_str, "Fuzzy hashes expired: %L\n", - ucl_object_toint (ucl_object_lookup (obj, "fuzzy_expired"))); + + st = ucl_object_lookup (obj, "fuzzy_hashes"); + if (st) { + ucl_object_iter_t it = NULL; + const ucl_object_t *cur; + gint64 stored = 0; + + while ((cur = ucl_iterate_object (st, &it, true)) != NULL) { + rspamd_printf_gstring (out_str, "Fuzzy hashes in storage \"%s\": %L\n", + ucl_object_key (cur), + ucl_object_toint (cur)); + stored += ucl_object_toint (cur); + } + + rspamd_printf_gstring (out_str, "Fuzzy hashes stored: %L\n", + stored); + } st = ucl_object_lookup (obj, "fuzzy_checked"); if (st != NULL && ucl_object_type (st) == UCL_ARRAY) { -- cgit v1.2.3