From: Vsevolod Stakhov Date: Thu, 5 Jan 2017 14:11:46 +0000 (+0000) Subject: [Minor] Add type of fuzzy to log files X-Git-Tag: 1.5.0~421 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f56cb9d4eca864b9943d33c1f83fcff49ec58a67;p=thirdparty%2Frspamd.git [Minor] Add type of fuzzy to log files --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 85f5c3bb3f..79de7bfe94 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1625,6 +1625,7 @@ fuzzy_insert_result (struct fuzzy_client_session *session, struct rspamd_task *task = session->task; double nval; guchar buf[2048]; + const gchar *type = "bin"; /* Get mapping by flag */ if ((map = @@ -1651,15 +1652,21 @@ fuzzy_insert_result (struct fuzzy_client_session *session, if (io && (io->flags & FUZZY_CMD_FLAG_IMAGE)) { nval *= rspamd_normalize_probability (rep->prob, 0.5); + type = "img"; } else { /* XXX: we need something better here */ + if (cmd->shingles_count > 0) { + type = "txt"; + } + nval *= rep->prob; } msg_info_task ( - "found fuzzy hash %*xs with weight: " + "found fuzzy hash(%s) %*xs with weight: " "%.2f, probability %.2f, in list: %s:%d%s", + type, (gint)sizeof (cmd->digest), cmd->digest, nval, (gdouble)rep->prob, @@ -1669,10 +1676,11 @@ fuzzy_insert_result (struct fuzzy_client_session *session, if (map != NULL || !session->rule->skip_unknown) { rspamd_snprintf (buf, sizeof (buf), - "%d:%*xs:%.2f", + "%d:%*xs:%.2f:%s", rep->flag, rspamd_fuzzy_hash_len, cmd->digest, - rep->prob); + rep->prob, + type); rspamd_task_insert_result_single (session->task, symbol, nval,