From: Christophe M Date: Tue, 29 Jul 2014 14:20:34 +0000 (+0200) Subject: Fix to output a JSON buffer to an Unix domain socket. X-Git-Tag: suricata-2.1beta2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6c2ae469be6a79b1405ca793f15c74c0fba0e3a8;p=thirdparty%2Fsuricata.git Fix to output a JSON buffer to an Unix domain socket. Create the JSON buffer and write to it like regular file. Upper function SCConfLogOpenGeneric already handle it properly. Closes issue #1246. --- diff --git a/src/output-json.c b/src/output-json.c index b37e9ad173..69ea7cf191 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -347,7 +347,7 @@ int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer) SCMutexLock(&file_ctx->fp_mutex); if (json_out == ALERT_SYSLOG) { syslog(alert_syslog_level, "%s", js_s); - } else if (json_out == ALERT_FILE) { + } else if (json_out == ALERT_FILE || json_out == ALERT_UNIX_DGRAM || json_out == ALERT_UNIX_STREAM) { MemBufferWriteString(buffer, "%s\n", js_s); file_ctx->Write((const char *)MEMBUFFER_BUFFER(buffer), MEMBUFFER_OFFSET(buffer), file_ctx); @@ -457,7 +457,7 @@ OutputCtx *OutputJsonInitCtx(ConfNode *conf) } } - if (json_ctx->json_out == ALERT_FILE) { + if (json_ctx->json_out == ALERT_FILE || json_ctx->json_out == ALERT_UNIX_DGRAM || json_ctx->json_out == ALERT_UNIX_STREAM) { if (SCConfLogOpenGeneric(conf, json_ctx->file_ctx, DEFAULT_LOG_FILENAME) < 0) { LogFileFreeCtx(json_ctx->file_ctx);