From e15c9451f2a8cf01577bda53ef7ab5b41b73951b Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Fri, 8 Apr 2022 09:47:31 -0400 Subject: [PATCH] log/stats: Ensure output exists for the stats thread Issue: 5198 This commit ensures that a log output destination exists for the stats thread. --- src/output-json-stats.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/output-json-stats.c b/src/output-json-stats.c index c456490904..126eef7a06 100644 --- a/src/output-json-stats.c +++ b/src/output-json-stats.c @@ -439,7 +439,14 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_ return result; } - stats_ctx->file_ctx = ajt->file_ctx; + SCLogDebug("Preparing file context for stats submodule logger"); + /* Share output slot with thread 1 */ + stats_ctx->file_ctx = LogFileEnsureExists(ajt->file_ctx); + if (!stats_ctx->file_ctx) { + SCFree(stats_ctx); + SCFree(output_ctx); + return result; + } output_ctx->data = stats_ctx; output_ctx->DeInit = OutputStatsLogDeinitSub; -- 2.47.2