]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Some fixes for log pipe handling
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Apr 2016 17:21:33 +0000 (18:21 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Apr 2016 17:21:33 +0000 (18:21 +0100)
src/libserver/rspamd_control.c
src/log_helper.c

index 7c5f365ddfeee0f9600eaa39f550bcad9711b30b..8c0a150e27ef95ca360734e190fab66aef3e5f89 100644 (file)
@@ -549,6 +549,7 @@ rspamd_control_default_cmd_handler (gint fd,
        case RSPAMD_CONTROL_HYPERSCAN_LOADED:
        case RSPAMD_CONTROL_FUZZY_STAT:
        case RSPAMD_CONTROL_FUZZY_SYNC:
+       case RSPAMD_CONTROL_LOG_PIPE:
                break;
        case RSPAMD_CONTROL_RERESOLVE:
                if (cd->worker->srv->cfg) {
@@ -806,6 +807,7 @@ rspamd_srv_handler (gint fd, short what, gpointer ud)
                                break;
                        case RSPAMD_SRV_LOG_PIPE:
                                memset (&wcmd, 0, sizeof (wcmd));
+                               wcmd.type = RSPAMD_CONTROL_LOG_PIPE;
                                wcmd.cmd.log_pipe.type = cmd.cmd.log_pipe.type;
                                rspamd_control_broadcast_cmd (srv, &wcmd, rfd,
                                                rspamd_control_log_pipe_io_handler, NULL);
index b1a241288a964e89d6e3ad65a89d472438b5eb10..7283c5d14ad2e33a4f96b24af9bc38db657dabad 100644 (file)
@@ -93,11 +93,13 @@ rspamd_log_helper_read (gint fd, short what, gpointer ud)
                        out = g_string_sized_new (31);
 
                        for (i = 0; i < n; i ++) {
-                               rspamd_printf_gstring (out, "%s%d", i == 0 ? "" : ", ",
-                                               sm->results[i]);
+
+                               rspamd_printf_gstring (out, "%s%s", i == 0 ? "" : ", ",
+                                               rspamd_symbols_cache_symbol_by_id (ctx->cfg->cache,
+                                                               sm->results[i]));
                        }
 
-                       msg_info ("got log line: %V", out);
+                       msg_info ("got log line: %v", out);
                        g_string_free (out, TRUE);
                        g_free (sm);
                }
@@ -115,6 +117,7 @@ rspamd_log_helper_reply_handler (struct rspamd_worker *worker,
        struct log_helper_ctx *ctx = ud;
 
        close (ctx->pair[1]);
+       msg_info ("start waiting for log events");
        event_set (&ctx->log_ev, ctx->pair[0], EV_READ | EV_PERSIST,
                        rspamd_log_helper_read, ctx);
        event_base_set (ctx->ev_base, &ctx->log_ev);