/* Handle messages without text */
if (tokens == NULL) {
i = rspamd_snprintf (out_buf, sizeof (out_buf), "learn failed, no tokens can be extracted (no text data)" CRLF);
+ msg_info ("learn failed for message <%s>, no tokens to extract", task->message_id);
free_task (task, FALSE);
if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) {
return FALSE;
statfile = get_statfile_by_symbol (session->worker->srv->statfile_pool, session->learn_classifier,
session->learn_symbol, &st, TRUE);
if (statfile == NULL) {
+ msg_info ("learn failed for message <%s>, no statfile found: %s", task->message_id, session->learn_symbol);
free_task (task, FALSE);
- i = rspamd_snprintf (out_buf, sizeof (out_buf), "learn failed" CRLF);
+ i = rspamd_snprintf (out_buf, sizeof (out_buf), "learn failed, invalid symbol" CRLF);
if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) {
return FALSE;
}
if (st->normalizer != NULL) {
sum = st->normalizer (session->cfg, sum, st->normalizer_data);
}
-
+ msg_info ("learn success for message <%s>, for statfile: %s, sum weight: %.2f",
+ task->message_id, session->learn_symbol, sum);
free_task (task, FALSE);
i = rspamd_snprintf (out_buf, sizeof (out_buf), "learn ok, sum weight: %.2f" CRLF, sum);
if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) {
symbol = map->symbol;
nval = fuzzy_normalize (value, map->weight);
}
-
+ msg_info ("<%s>, found fuzzy hash with weight: %.2f, in list: %d",
+ session->task->message_id, flag, nval);
rspamd_snprintf (buf, sizeof (buf), "%d: %d / %.2f", flag, value, nval);
insert_result (session->task, symbol, nval, g_list_prepend (NULL,
memory_pool_strdup (session->task->task_pool, buf)));
goto err;
}
else if (buf[0] == 'O' && buf[1] == 'K') {
+ msg_info ("added fuzzy hash for message <%s>", session->task->message_id);
r = rspamd_snprintf (buf, sizeof (buf), "OK" CRLF);
if (! rspamd_dispatcher_write (session->session->dispatcher, buf, r, FALSE, FALSE)) {
return;
goto ok;
}
else {
+ msg_info ("cannot add fuzzy hash for message <%s>", session->task->message_id);
r = rspamd_snprintf (buf, sizeof (buf), "ERR" CRLF);
if (! rspamd_dispatcher_write (session->session->dispatcher, buf, r, FALSE, FALSE)) {
return;
/* Check whitelist */
if (fuzzy_module_ctx->whitelist && task->from_addr.s_addr != 0) {
if (radix32tree_find (fuzzy_module_ctx->whitelist, ntohl ((uint32_t) task->from_addr.s_addr)) != RADIX_NO_VALUE) {
- msg_info ("address %s is whitelisted, skip fuzzy check", inet_ntoa (task->from_addr));
+ msg_info ("<%s>, address %s is whitelisted, skip fuzzy check",
+ task->message_id, inet_ntoa (task->from_addr));
return;
}
}
/* Check length of hash */
if (fuzzy_module_ctx->min_hash_len != 0 &&
strlen (part->fuzzy->hash_pipe) * part->fuzzy->block_size < fuzzy_module_ctx->min_hash_len) {
- msg_info ("part hash is shorter than %d symbols, skip fuzzy check", fuzzy_module_ctx->min_hash_len);
+ msg_info ("<%s>, part hash is shorter than %d symbols, skip fuzzy check",
+ task->message_id, fuzzy_module_ctx->min_hash_len);
cur = g_list_next (cur);
continue;
}