From 7fa98cde4d139ee5dea93caa040b588aea8b1023 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Fri, 26 Mar 2021 10:06:44 -0400 Subject: [PATCH] output/redis: Redis threaded output changes --- src/output-json.c | 1 - src/util-log-redis.c | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/output-json.c b/src/output-json.c index 82637ad83a..9c4d9f63bc 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -1182,7 +1182,6 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf) } if (SCConfLogOpenRedis(redis_node, json_ctx->file_ctx) < 0) { - SCFree(json_ctx->file_ctx->sensor_name); LogFileFreeCtx(json_ctx->file_ctx); SCFree(json_ctx); SCFree(output_ctx); diff --git a/src/util-log-redis.c b/src/util-log-redis.c index 4f437f02ba..544bef1545 100644 --- a/src/util-log-redis.c +++ b/src/util-log-redis.c @@ -1,5 +1,5 @@ /* vi: set et ts=4: */ -/* Copyright (C) 2007-2016 Open Information Security Foundation +/* Copyright (C) 2007-2021 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -53,7 +53,7 @@ void SCLogRedisInit() #endif /* HAVE_LIBEVENT_PTHREADS */ } -/** \brief SCLogRedisContextAlloc() - Allocates and initalizes redis context +/** \brief SCLogRedisContextAlloc() - Allocates and initializes redis context */ static SCLogRedisContext *SCLogRedisContextAlloc(void) { @@ -430,7 +430,7 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string) * \param log_ctx Log file context allocated by caller * \param string buffer with data to write * \param string_len data length - * \retval 0 on sucess; + * \retval 0 on success; * \retval -1 on failure; */ int LogFileWriteRedis(void *lf_ctx, const char *string, size_t string_len) @@ -462,6 +462,10 @@ int SCConfLogOpenRedis(ConfNode *redis_node, void *lf_ctx) { LogFileCtx *log_ctx = lf_ctx; + if (log_ctx->threaded) { + FatalError(SC_ERR_FATAL, "redis does not support threaded output"); + } + const char *redis_port = NULL; const char *redis_mode = NULL;