Go to the documentation of this file.
113 typedef struct LoggerThreadStoreNode_ {
118 typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_) LoggerThreadStore;
128 typedef struct OutputFileRolloverFlag_ {
134 TAILQ_HEAD(, OutputFileRolloverFlag_) output_file_rotation_flags =
160 SCLogDebug(
"Output module \"%s\" registered.", name);
165 FatalError(
"Fatal error encountered in OutputRegisterModule. Exiting...");
182 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
202 SCLogDebug(
"Packet logger \"%s\" registered.", name);
205 FatalError(
"Fatal error encountered. Exiting...");
222 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
243 SCLogDebug(
"Packet logger \"%s\" registered.", name);
246 FatalError(
"Fatal error encountered. Exiting...");
257 static void OutputRegisterTxModuleWrapper(
LoggerId id,
const char *name,
259 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
287 SCLogDebug(
"Tx logger \"%s\" registered.", name);
290 FatalError(
"Fatal error encountered. Exiting...");
293 static void OutputRegisterTxSubModuleWrapper(
LoggerId id,
const char *parent_name,
324 SCLogDebug(
"Tx logger for alproto %d \"%s\" registered.", alproto, name);
327 FatalError(
"Fatal error encountered. Exiting...");
344 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
345 TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
346 ThreadExitPrintStats);
350 const char *parent_name,
const char *name,
const char *conf_name,
356 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
357 alproto, TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
358 ThreadExitPrintStats);
371 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
375 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
376 TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
377 ThreadDeinit, ThreadExitPrintStats);
387 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
388 alproto, TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
389 ThreadDeinit, ThreadExitPrintStats);
406 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
407 TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
408 ThreadExitPrintStats);
412 const char *name,
const char *conf_name,
417 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name,
418 InitFunc, alproto, TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
419 ThreadExitPrintStats);
435 if (
unlikely(FileLogFunc == NULL)) {
454 SCLogDebug(
"File logger \"%s\" registered.", name);
457 FatalError(
"Fatal error encountered. Exiting...");
474 if (
unlikely(FileLogFunc == NULL)) {
494 SCLogDebug(
"File logger \"%s\" registered.", name);
497 FatalError(
"Fatal error encountered. Exiting...");
514 if (
unlikely(FiledataLogFunc == NULL)) {
533 SCLogDebug(
"Filedata logger \"%s\" registered.", name);
536 FatalError(
"Fatal error encountered. Exiting...");
553 if (
unlikely(FiledataLogFunc == NULL)) {
573 SCLogDebug(
"Filedata logger \"%s\" registered.", name);
576 FatalError(
"Fatal error encountered. Exiting...");
593 if (
unlikely(FlowLogFunc == NULL)) {
613 SCLogDebug(
"Flow logger \"%s\" registered.", name);
616 FatalError(
"Fatal error encountered. Exiting...");
634 if (
unlikely(StreamingLogFunc == NULL)) {
654 SCLogDebug(
"Streaming logger \"%s\" registered.", name);
657 FatalError(
"Fatal error encountered. Exiting...");
674 if (
unlikely(StreamingLogFunc == NULL)) {
695 SCLogDebug(
"Streaming logger \"%s\" registered.", name);
698 FatalError(
"Fatal error encountered. Exiting...");
714 if (
unlikely(StatsLogFunc == NULL)) {
733 SCLogDebug(
"Stats logger \"%s\" registered.", name);
736 FatalError(
"Fatal error encountered. Exiting...");
753 if (
unlikely(StatsLogFunc == NULL)) {
773 SCLogDebug(
"Stats logger \"%s\" registered.", name);
776 FatalError(
"Fatal error encountered. Exiting...");
790 if (strcmp(module->
conf_name, conf_name) == 0)
810 static int drop_loggers = 0;
836 SCLogError(
"Failed to allocate memory to register file rotation flag");
839 flag_entry->flag = flag;
856 for (entry =
TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;
859 if (entry->flag == flag) {
860 TAILQ_REMOVE(&output_file_rotation_flags, entry, entries);
879 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
882 while (logger && thread_store_node) {
883 logger->
LogFunc(
tv, p, thread_store_node->thread_data);
886 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
893 LoggerThreadStore *thread_store =
SCCalloc(1,
sizeof(*thread_store));
894 if (thread_store == NULL) {
898 *data = (
void *)thread_store;
903 void *child_thread_data = NULL;
907 SCCalloc(1,
sizeof(*thread_store_node));
908 if (thread_store_node == NULL) {
914 thread_store_node->thread_data = child_thread_data;
924 if (thread_data == NULL)
927 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
930 while (logger && thread_store_node) {
935 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
939 while ((thread_store_node =
TAILQ_FIRST(thread_store)) != NULL) {
941 SCFree(thread_store_node);
950 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
953 while (logger && thread_store_node) {
958 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
970 if (logger == NULL) {
981 static void OutputRegisterActiveLogger(
RootLogger *reg)
984 if (logger == NULL) {
1001 OutputRegisterActiveLogger(logger);
1011 while ((logger =
TAILQ_FIRST(&active_loggers)) != NULL) {
ThreadDeinitFunc ThreadDeinit
void LogTlsStoreRegister(void)
int OutputDropLoggerEnable(void)
TmEcode(* OutputLogFunc)(ThreadVars *, Packet *, void *)
void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a stats data output sub-module.
void JsonDCERPCLogRegister(void)
void OutputTxLoggerRegister(void)
void JsonPgsqlLogRegister(void)
void JsonSMBLogRegister(void)
void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data)
void OutputFileLoggerRegister(void)
struct HtpBodyChunk_ * next
StreamingLogger StreamingLogFunc
void LogTlsLogRegister(void)
int(* StreamingLogger)(ThreadVars *, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
void AlertFastLogRegister(void)
void JsonFileLogRegister(void)
void JsonRdpLogRegister(void)
void JsonSNMPLogRegister(void)
void JsonDNP3LogRegister(void)
void LogCustomFormatRegister(void)
#define TAILQ_FOREACH(var, head, field)
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
void OutputSetupActiveLoggers(void)
void AlertSyslogRegister(void)
Function to register the AlertSyslog module.
void OutputRegisterTxModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module.
void OutputRegisterFileSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file output sub-module.
void JsonDHCPLogRegister(void)
int(* TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id)
int(* FlowLogger)(ThreadVars *, void *thread_data, Flow *f)
int(* PacketLogger)(ThreadVars *, void *thread_data, const Packet *)
#define TAILQ_INSERT_TAIL(head, elm, field)
void JsonSshLogRegister(void)
void PcapLogRegister(void)
OutputInitSubFunc InitSubFunc
void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, StreamingLogger StreamingLogFunc, enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a streaming data output module.
PacketLogger PacketLogFunc
void JsonStatsLogRegister(void)
void LogTcpDataLogRegister(void)
void OutputRegisterRootLoggers(void)
Register all root loggers.
TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data)
void JsonTlsLogRegister(void)
void JsonFlowLogRegister(void)
void TmModuleLoggerRegister(void)
void OutputJsonRegister(void)
void OutputClearActiveLoggers(void)
enum OutputStreamingType stream_type
#define TAILQ_ENTRY(type)
void OutputRegisterFileRotationFlag(int *flag)
Register a flag for file rotation notification.
void LogHttpLogRegister(void)
ThreadInitFunc ThreadInit
#define TAILQ_HEAD_INITIALIZER(head)
OutputModuleList output_modules
OutputInitResult(* OutputInitSubFunc)(ConfNode *, OutputCtx *)
void JsonAnomalyLogRegister(void)
#define TAILQ_REMOVE(head, elm, field)
FiledataLogger FiledataLogFunc
#define TAILQ_FIRST(head)
void OutputStreamingLoggerRegister(void)
int(* FileLogger)(ThreadVars *, void *thread_data, const Packet *, const File *, void *tx, const uint64_t tx_id, uint8_t direction)
void OutputRegisterFiledataSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file data output sub-module.
void JsonTFTPLogRegister(void)
int(* FiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx, const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
ThreadDeinitFunc ThreadDeinit
void OutputRegisterTxSubModuleWithProgress(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
void OutputRegisterModule(const char *, const char *, OutputInitFunc)
void JsonIKELogRegister(void)
Per thread variable structure.
void OutputRegisterStreamingSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StreamingLogger StreamingLogFunc, enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a streaming data output sub-module.
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
void JsonMQTTLogRegister(void)
void OutputFilestoreRegister(void)
void JsonQuicLogRegister(void)
void OutputRegisterLoggers(void)
Register all non-root logging modules.
void OutputDeregisterAll(void)
Deregister all modules. Useful for a memory clean exit.
OutputGetActiveCountFunc ActiveCntFunc
void OutputPacketLoggerRegister(void)
void OutputNotifyFileRotation(void)
Notifies all registered file rotation notification flags.
typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_)
void EveStreamLogRegister(void)
ThreadExitPrintStatsFunc ThreadExitPrintStats
ThreadInitFunc ThreadInit
void OutputRegisterTxSubModuleWithCondition(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
void LogStatsLogRegister(void)
void JsonFrameLogRegister(void)
void OutputRegisterFiledataModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file data output module.
TxLoggerCondition TxLogCondition
void JsonBitTorrentDHTLogRegister(void)
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output sub-module.
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
#define TAILQ_NEXT(elm, field)
ThreadExitPrintStatsFunc ThreadExitPrintStats
void LuaLogRegister(void)
void OutputRegisterTxSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
void JsonSmtpLogRegister(void)
PacketLogCondition PacketConditionFunc
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output module.
struct RootLogger_ RootLogger
uint32_t(* OutputGetActiveCountFunc)(void)
int(* PacketLogCondition)(ThreadVars *, void *thread_data, const Packet *)
void JsonHttp2LogRegister(void)
int(* TxLoggerCondition)(ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id)
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a flow output sub-module.
void JsonDnsLogRegister(void)
#define SCLogError(...)
Macro used to log ERROR messages.
TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
void OutputRegisterFileModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file output module.
void JsonDropLogRegister(void)
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
void OutputRegisterTxModuleWithProgress(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module with progress.
OutputInitResult(* OutputInitFunc)(ConfNode *)
void JsonFTPLogRegister(void)
void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
void JsonRFBLogRegister(void)
void JsonHttpLogRegister(void)
void JsonTemplateLogRegister(void)
void JsonModbusLogRegister(void)
void AlertDebugLogRegister(void)
void OutputUnregisterFileRotationFlag(int *flag)
Unregister a file rotation flag.
void OutputFiledataLoggerRegister(void)
void JsonSIPLogRegister(void)
void JsonKRB5LogRegister(void)
void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a stats data output module.
void OutputRegisterTxModuleWithCondition(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module with condition.
void JsonAlertLogRegister(void)
void JsonNFSLogRegister(void)
void OutputDropLoggerDisable(void)
void JsonNetFlowLogRegister(void)
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)