From: Jeff Lucovsky Date: Fri, 8 Apr 2022 13:47:31 +0000 (-0400) Subject: log/stats: Ensure output exists for the stats thread X-Git-Tag: suricata-7.0.0-rc1~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e15c9451f2a8cf01577bda53ef7ab5b41b73951b;p=thirdparty%2Fsuricata.git log/stats: Ensure output exists for the stats thread Issue: 5198 This commit ensures that a log output destination exists for the stats thread. --- 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;