]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: cleanup JSON logging 1753/head
authorVictor Julien <victor@inliniac.net>
Mon, 2 Nov 2015 08:54:46 +0000 (09:54 +0100)
committerVictor Julien <victor@inliniac.net>
Sun, 22 Nov 2015 10:35:47 +0000 (11:35 +0100)
src/output-json.c
src/util-logopenfile.c
src/util-logopenfile.h

index ed54d0df313dbcfc7d3d2f3ce72022be99354746..9cc9bd94b4e0d9e06ef1a0c8a9e15cfd805d7b3b 100644 (file)
@@ -367,9 +367,7 @@ int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer)
     if (r != 0)
         return TM_ECODE_OK;
 
-    LogFileWrite(file_ctx, buffer,
-           (char *)MEMBUFFER_BUFFER(buffer),
-                   MEMBUFFER_OFFSET(buffer));
+    LogFileWrite(file_ctx, buffer);
     return 0;
 }
 
index d2bc61b4e88e7daa93682b23fdc621131c33b380..65b80facccb019c20868e74f15c3150dc2fd1738 100644 (file)
@@ -615,10 +615,11 @@ static int  LogFileWriteRedis(LogFileCtx *file_ctx, char *string, size_t string_
 }
 #endif
 
-int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer, char *string, size_t string_len)
+int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer)
 {
     if (file_ctx->type == LOGFILE_TYPE_SYSLOG) {
-        syslog(file_ctx->syslog_setup.alert_syslog_level, "%s", string);
+        syslog(file_ctx->syslog_setup.alert_syslog_level, "%s",
+                (const char *)MEMBUFFER_BUFFER(buffer));
     } else if (file_ctx->type == LOGFILE_TYPE_FILE ||
                file_ctx->type == LOGFILE_TYPE_UNIX_DGRAM ||
                file_ctx->type == LOGFILE_TYPE_UNIX_STREAM)
@@ -633,7 +634,8 @@ int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer, char *string, size_t s
 #ifdef HAVE_LIBHIREDIS
     else if (file_ctx->type == LOGFILE_TYPE_REDIS) {
         SCMutexLock(&file_ctx->fp_mutex);
-        LogFileWriteRedis(file_ctx, string, string_len);
+        LogFileWriteRedis(file_ctx, (const char *)MEMBUFFER_BUFFER(buffer),
+                MEMBUFFER_OFFSET(buffer));
         SCMutexUnlock(&file_ctx->fp_mutex);
     }
 #endif
index d2924503d78f3031ba5380640b94d4a3f4ed37ac..f0a123accbccfeb945c65bb3e0e6632fba5d7914 100644 (file)
@@ -130,7 +130,7 @@ typedef struct LogFileCtx_ {
 
 LogFileCtx *LogFileNewCtx(void);
 int LogFileFreeCtx(LogFileCtx *);
-int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer, char *string, size_t string_len);
+int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer);
 
 int SCConfLogOpenGeneric(ConfNode *conf, LogFileCtx *, const char *, int);
 int SCConfLogOpenRedis(ConfNode *conf, LogFileCtx *log_ctx);