From 8395a9201e3963789d47b90b70c09f6cb20b464a Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Tue, 8 Sep 2020 08:26:36 -0400 Subject: [PATCH] log: Ensure threaded eve honors SIGHUP This commit ensures that all logging contexts register for the file rotation mechanism (SIGHUP and configured). --- src/util-logopenfile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 1c1c4e4bdc..3eb6566aba 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -736,8 +736,10 @@ static bool LogFileNewThreadedCtx(LogFileCtx *parent_ctx, const char *log_path, thread->threaded = false; thread->parent = parent_ctx; thread->id = thread_id; + thread->is_regular = true; thread->Write = SCLogFileWriteNoLock; thread->Close = SCLogFileCloseNoLock; + OutputRegisterFileRotationFlag(&thread->rotation_flag); parent_ctx->threads->lf_slots[thread_id] = thread; return true; @@ -767,6 +769,7 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx) SCMutexDestroy(&lf_ctx->threads->mutex); for(int i = 0; i < lf_ctx->threads->slot_count; i++) { if (lf_ctx->threads->lf_slots[i]) { + OutputUnregisterFileRotationFlag(&lf_ctx->threads->lf_slots[i]->rotation_flag); SCFree(lf_ctx->threads->lf_slots[i]->filename); SCFree(lf_ctx->threads->lf_slots[i]); } @@ -801,7 +804,9 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx) if (lf_ctx->sensor_name) SCFree(lf_ctx->sensor_name); - OutputUnregisterFileRotationFlag(&lf_ctx->rotation_flag); + if (!lf_ctx->threaded) { + OutputUnregisterFileRotationFlag(&lf_ctx->rotation_flag); + } SCFree(lf_ctx); -- 2.47.2