/**
* \brief Initializes stats context
*/
-static void StatsInitCtx(void)
+static void StatsInitCtxPreOutput(void)
{
SCEnter();
#ifdef AFLFUZZ_DISABLE_MGTTHREADS
}
stats_decoder_events_prefix = prefix;
}
+ SCReturn;
+}
+
+static void StatsInitCtxPostOutput(void)
+{
+ SCEnter();
+ /* Store the engine start time */
+ time(&stats_start_time);
+
+ /* init the lock used by StatsThreadStore */
+ if (SCMutexInit(&stats_ctx->sts_lock, NULL) != 0) {
+ SCLogError(SC_ERR_INITIALIZATION, "error initializing sts mutex");
+ exit(EXIT_FAILURE);
+ }
if (!OutputStatsLoggersRegistered()) {
stats_loggers_active = 0;
}
}
- /* Store the engine start time */
- time(&stats_start_time);
-
- /* init the lock used by StatsThreadStore */
- if (SCMutexInit(&stats_ctx->sts_lock, NULL) != 0) {
- SCLogError(SC_ERR_INITIALIZATION, "error initializing sts mutex");
- exit(EXIT_FAILURE);
- }
-
SCReturn;
}
StatsPublicThreadContextInit(&stats_ctx->global_counter_ctx);
}
-void StatsSetupPostConfig(void)
+void StatsSetupPostConfigPreOutput(void)
+{
+ StatsInitCtxPreOutput();
+}
+
+void StatsSetupPostConfigPostOutput(void)
{
- StatsInitCtx();
+ StatsInitCtxPostOutput();
}
+
/**
* \brief Spawns the wakeup, and the management thread used by the stats api
*
/* the initialization functions */
void StatsInit(void);
-void StatsSetupPostConfig(void);
+void StatsSetupPostConfigPreOutput(void);
+void StatsSetupPostConfigPostOutput(void);
void StatsSpawnThreads(void);
void StatsRegisterTests(void);
#ifdef HAVE_LIBJANSSON
+extern bool stats_decoder_events;
+const char *stats_decoder_events_prefix;
+
/**
* specify which engine info will be printed in stats log.
* ALL means both last reload and ruleset stats.
return result;
}
+ if (stats_decoder_events &&
+ strcmp(stats_decoder_events_prefix, "decoder") == 0) {
+ SCLogWarning(SC_WARN_EVE_MISSING_EVENTS, "json stats will not display "
+ "all decoder events correctly. See #2225. Set a prefix in "
+ "stats.decoder-events-prefix. In 5.0 the prefix will default "
+ "to 'decoder.event'.");
+ }
+
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
if (unlikely(stats_ctx == NULL))
return result;
+ if (stats_decoder_events &&
+ strcmp(stats_decoder_events_prefix, "decoder") == 0) {
+ SCLogWarning(SC_WARN_EVE_MISSING_EVENTS, "eve.stats will not display "
+ "all decoder events correctly. See #2225. Set a prefix in "
+ "stats.decoder-events-prefix. In 5.0 the prefix will default "
+ "to 'decoder.event'.");
+ }
+
stats_ctx->flags = JSON_STATS_TOTALS;
if (conf != NULL) {
if (runmode == RUNMODE_UNIX_SOCKET)
return;
+ StatsSetupPostConfigPreOutput();
RunModeInitializeOutputs();
- StatsSetupPostConfig();
+ StatsSetupPostConfigPostOutput();
}
/* clean up / shutdown code for both the main modes and for
CASE_CODE (SC_ERR_WINDIVERT_TOOLONG_FILTER);
CASE_CODE (SC_WARN_RUST_NOT_AVAILABLE);
CASE_CODE (SC_WARN_DEFAULT_WILL_CHANGE);
+ CASE_CODE (SC_WARN_EVE_MISSING_EVENTS);
CASE_CODE (SC_ERR_MAX);
}
SC_ERR_WINDIVERT_TOOLONG_FILTER,
SC_WARN_RUST_NOT_AVAILABLE,
SC_WARN_DEFAULT_WILL_CHANGE,
+ SC_WARN_EVE_MISSING_EVENTS,
SC_ERR_MAX,
} SCError;