Go to the documentation of this file.
36 intmax_t output_flush_interval = 0;
37 if (
SCConfGetInt(
"heartbeat.output-flush-interval", &output_flush_interval) == 0) {
38 output_flush_interval = 0;
40 if (output_flush_interval < 0 || output_flush_interval > 60) {
41 SCLogConfig(
"flush_interval must be 0 or less than 60; using 0");
42 output_flush_interval = 0;
45 return (
int)output_flush_interval;
48 static void *LogFlusherWakeupThread(
void *arg)
52 BUG_ON(output_flush_interval == 0);
54 SCLogConfig(
"Using output-flush-interval of %d seconds", output_flush_interval);
60 const int log_flush_sleep_time = 500;
61 const int flush_wait_count = (1000 * output_flush_interval) / log_flush_sleep_time;
76 uint64_t worker_flush_count = 0;
81 if (++wait_count == flush_wait_count) {
95 SCLogInfo(
"%s: initiated %" PRIu64
" flushes", tv_local->
name, worker_flush_count);
102 SCLogConfig(
"log flusher thread not used with heartbeat.output-flush-interval of 0");
109 FatalError(
"Unable to create and start log flush thread");
TmEcode TmThreadSpawn(ThreadVars *tv)
Spawns a thread associated with the ThreadVars instance tv.
TmEcode TmThreadSetupOptions(ThreadVars *tv)
Set the thread options (cpu affinitythread). Priority should be already set by pthread_create.
void TmThreadsSetFlag(ThreadVars *tv, uint32_t flag)
Set a thread flag.
void TmThreadWaitForFlag(ThreadVars *tv, uint32_t flags)
Waits till the specified flag(s) is(are) set. We don't bother if the kill flag has been set or not on...
#define SCSetThreadName(n)
int SCConfGetInt(const char *name, intmax_t *val)
Retrieve a configuration value as an integer.
int OutputFlushInterval(void)
Per thread variable structure.
void LogFileFlushAll(void)
Flush all registered LogFileCtx instances.
uint8_t thread_setup_flags
ThreadVars * TmThreadCreateMgmtThread(const char *name, void *(fn_p)(void *), int mucond)
Creates and returns the TV instance for a Management thread(MGMT). This function supports only custom...
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void LogFlushThreads(void)
const char * thread_name_heartbeat
bool TmThreadsWaitForUnpause(ThreadVars *tv)
Wait for a thread to become unpaused.
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
int TmThreadsCheckFlag(ThreadVars *tv, uint32_t flag)
Check if a thread flag is set.