]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix to output a JSON buffer to an Unix domain socket.
authorChristophe M <lessyv@gandi.net>
Tue, 29 Jul 2014 14:20:34 +0000 (16:20 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 3 Nov 2014 13:25:43 +0000 (14:25 +0100)
Create the JSON buffer and write to it like regular file.

Upper function SCConfLogOpenGeneric already handle it properly.

Closes issue #1246.

src/output-json.c

index b37e9ad1733df638d3d393159c1bc7eb981251a2..69ea7cf1914137e43a3ff27e5e56383e1d143287 100644 (file)
@@ -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);