From c80990fe1046876753cd7536db32236a77173f23 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 2 Nov 2015 09:54:46 +0100 Subject: [PATCH] output: cleanup JSON logging --- src/output-json.c | 4 +--- src/util-logopenfile.c | 8 +++++--- src/util-logopenfile.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/output-json.c b/src/output-json.c index ed54d0df31..9cc9bd94b4 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -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; } diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index d2bc61b4e8..65b80faccc 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -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 diff --git a/src/util-logopenfile.h b/src/util-logopenfile.h index d2924503d7..f0a123accb 100644 --- a/src/util-logopenfile.h +++ b/src/util-logopenfile.h @@ -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);