]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
log/stats: Ensure output exists for the stats thread 8356/head
authorJeff Lucovsky <jeff@lucovsky.org>
Fri, 8 Apr 2022 13:47:31 +0000 (09:47 -0400)
committerJeff Lucovsky <jlucovsky@oisf.net>
Mon, 9 Jan 2023 15:20:37 +0000 (10:20 -0500)
Issue: 5198

This commit ensures that a log output destination exists for the stats
thread.

src/output-json-stats.c

index c4564909044278ea38069ce01bec73b743100e11..126eef7a06c8481bd5e6b32f3d9d12b9bd521b87 100644 (file)
@@ -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;