diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-08-02 16:46:28 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-08-02 16:46:28 +0400 |
commit | 76ba7fe19e094bf447c6f9eeab5c4654c002f873 (patch) | |
tree | 5e8df11035f464e71c9172c23938b4891391d32c | |
parent | c67ecf02a43fb17931c8aa9255ccf92dfc253981 (diff) | |
download | rspamd-76ba7fe19e094bf447c6f9eeab5c4654c002f873.tar.gz rspamd-76ba7fe19e094bf447c6f9eeab5c4654c002f873.zip |
* Add logging for fuzzy checks
* Add logging for learning
-rw-r--r-- | src/controller.c | 7 | ||||
-rw-r--r-- | src/plugins/fuzzy_check.c | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/controller.c b/src/controller.c index 424db1271..6ef9f7e08 100644 --- a/src/controller.c +++ b/src/controller.c @@ -809,6 +809,7 @@ controller_read_socket (f_str_t * in, void *arg) /* 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; @@ -821,8 +822,9 @@ controller_read_socket (f_str_t * in, void *arg) 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; } @@ -842,7 +844,8 @@ controller_read_socket (f_str_t * in, void *arg) 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)) { diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 4567f62cf..49b9b976e 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -383,7 +383,8 @@ fuzzy_io_callback (int fd, short what, void *arg) 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))); @@ -446,6 +447,7 @@ fuzzy_learn_callback (int fd, short what, void *arg) 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; @@ -453,6 +455,7 @@ fuzzy_learn_callback (int fd, short what, void *arg) 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; @@ -529,7 +532,8 @@ fuzzy_symbol_callback (struct worker_task *task, void *unused) /* 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; } } @@ -546,7 +550,8 @@ fuzzy_symbol_callback (struct worker_task *task, void *unused) /* 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; } |