Go to the documentation of this file.
107 typedef struct LoggerThreadStoreNode_ {
112 typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_) LoggerThreadStore;
122 typedef struct OutputFileRolloverFlag_ {
128 TAILQ_HEAD(, OutputFileRolloverFlag_) output_file_rotation_flags =
154 SCLogDebug(
"Output module \"%s\" registered.", name);
159 FatalError(
"Fatal error encountered in OutputRegisterModule. Exiting...");
176 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
196 SCLogDebug(
"Packet logger \"%s\" registered.", name);
199 FatalError(
"Fatal error encountered. Exiting...");
216 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
237 SCLogDebug(
"Packet logger \"%s\" registered.", name);
240 FatalError(
"Fatal error encountered. Exiting...");
251 static void OutputRegisterTxModuleWrapper(
LoggerId id,
const char *name,
253 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
281 SCLogDebug(
"Tx logger \"%s\" registered.", name);
284 FatalError(
"Fatal error encountered. Exiting...");
287 static void OutputRegisterTxSubModuleWrapper(
LoggerId id,
const char *parent_name,
318 SCLogDebug(
"Tx logger for alproto %d \"%s\" registered.", alproto, name);
321 FatalError(
"Fatal error encountered. Exiting...");
338 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
339 TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
340 ThreadExitPrintStats);
344 const char *parent_name,
const char *name,
const char *conf_name,
350 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
351 alproto, TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
352 ThreadExitPrintStats);
365 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
369 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
370 TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
371 ThreadDeinit, ThreadExitPrintStats);
381 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
382 alproto, TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
383 ThreadDeinit, ThreadExitPrintStats);
400 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
401 TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
402 ThreadExitPrintStats);
406 const char *name,
const char *conf_name,
411 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name,
412 InitFunc, alproto, TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
413 ThreadExitPrintStats);
430 if (
unlikely(FileLogFunc == NULL)) {
450 SCLogDebug(
"File logger \"%s\" registered.", name);
453 FatalError(
"Fatal error encountered. Exiting...");
470 if (
unlikely(FiledataLogFunc == NULL)) {
489 SCLogDebug(
"Filedata logger \"%s\" registered.", name);
492 FatalError(
"Fatal error encountered. Exiting...");
509 if (
unlikely(FlowLogFunc == NULL)) {
529 SCLogDebug(
"Flow logger \"%s\" registered.", name);
532 FatalError(
"Fatal error encountered. Exiting...");
550 if (
unlikely(StreamingLogFunc == NULL)) {
570 SCLogDebug(
"Streaming logger \"%s\" registered.", name);
573 FatalError(
"Fatal error encountered. Exiting...");
589 if (
unlikely(StatsLogFunc == NULL)) {
608 SCLogDebug(
"Stats logger \"%s\" registered.", name);
611 FatalError(
"Fatal error encountered. Exiting...");
628 if (
unlikely(StatsLogFunc == NULL)) {
648 SCLogDebug(
"Stats logger \"%s\" registered.", name);
651 FatalError(
"Fatal error encountered. Exiting...");
665 if (strcmp(module->
conf_name, conf_name) == 0)
685 static int drop_loggers = 0;
711 SCLogError(
"Failed to allocate memory to register file rotation flag");
714 flag_entry->flag = flag;
731 for (entry =
TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;
734 if (entry->flag == flag) {
735 TAILQ_REMOVE(&output_file_rotation_flags, entry, entries);
754 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
757 while (logger && thread_store_node) {
758 logger->
LogFunc(
tv, p, thread_store_node->thread_data);
761 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
768 LoggerThreadStore *thread_store =
SCCalloc(1,
sizeof(*thread_store));
769 if (thread_store == NULL) {
773 *data = (
void *)thread_store;
778 void *child_thread_data = NULL;
782 SCCalloc(1,
sizeof(*thread_store_node));
783 if (thread_store_node == NULL) {
789 thread_store_node->thread_data = child_thread_data;
799 if (thread_data == NULL)
802 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
805 while (logger && thread_store_node) {
810 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
814 while ((thread_store_node =
TAILQ_FIRST(thread_store)) != NULL) {
816 SCFree(thread_store_node);
825 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
828 while (logger && thread_store_node) {
833 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
845 if (logger == NULL) {
856 static void OutputRegisterActiveLogger(
RootLogger *reg)
859 if (logger == NULL) {
876 OutputRegisterActiveLogger(logger);
886 while ((logger =
TAILQ_FIRST(&active_loggers)) != NULL) {
911 void *state,
void *tx, uint64_t tx_id,
int dir)
931 name =
"bittorrent_dht";
941 if (!al->
LogTx(tx, js)) {
956 void *state,
void *tx, uint64_t tx_id)
958 return JsonGenericLogger(
tv, thread_data, p, f, state, tx, tx_id,
LOG_DIR_PACKET);
962 void *state,
void *tx, uint64_t tx_id)
964 return JsonGenericLogger(
tv, thread_data, p, f, state, tx, tx_id,
LOG_DIR_FLOW);
1014 SCLogDebug(
"modbus json logger registered.");
1115 if (
ConfGetNode(
"app-layer.protocols.bittorrent-dht") != NULL) {
1173 BUG_ON(simple_json_applayer_loggers[alproto].
proto != alproto);
1174 return &simple_json_applayer_loggers[alproto];
ThreadDeinitFunc ThreadDeinit
void LogTlsStoreRegister(void)
OutputInitResult OutputJsonLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
int OutputDropLoggerEnable(void)
TmEcode(* OutputLogFunc)(ThreadVars *, Packet *, void *)
void JsonDoh2LogRegister(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)
bool AlertJsonDoh2(void *txptr, JsonBuilder *js)
void JsonSMBLogRegister(void)
void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data)
void OutputFileLoggerRegister(void)
struct HtpBodyChunk_ * next
EveJsonSimpleAppLayerLogger * SCEveJsonSimpleGetLogger(AppProto alproto)
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
TmEcode JsonLogThreadInit(ThreadVars *t, const void *initdata, void **data)
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)
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
void AlertFastLogRegister(void)
void JsonFileLogRegister(void)
int OutputJsonBuilderBuffer(JsonBuilder *js, OutputJsonThreadCtx *ctx)
void JsonDNP3LogRegister(void)
void LogCustomFormatRegister(void)
#define TAILQ_FOREACH(var, head, field)
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
bool SSHTxLogCondition(ThreadVars *tv, const Packet *p, void *state, void *tx, uint64_t tx_id)
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 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
bool(* EveJsonSimpleTxLogFunc)(void *, struct JsonBuilder *)
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)
bool JsonPgsqlAddMetadata(void *vtx, JsonBuilder *jb)
void TmModuleLoggerRegister(void)
bool JsonTlsLogJSONExtended(void *vtx, JsonBuilder *tjs)
bool EveFTPDataAddMetadata(void *vtx, JsonBuilder *jb)
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)
bool AlertJsonDnp3(void *vtx, JsonBuilder *js)
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)
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)
JsonBuilder * CreateEveHeader(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
void JsonIKELogRegister(void)
Per thread variable structure.
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
bool EveFTPLogCommand(void *vtx, JsonBuilder *jb)
TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
void JsonMQTTLogRegister(void)
void OutputFilestoreRegister(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)
bool(* TxLoggerCondition)(ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id)
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
bool AlertJsonDns(void *txptr, JsonBuilder *js)
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.
EveJsonSimpleTxLogFunc LogTx
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)
bool(* PacketLogCondition)(ThreadVars *, void *thread_data, const Packet *)
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)
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)
bool JsonMQTTAddMetadata(void *vtx, JsonBuilder *js)
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 OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
void JsonHttpLogRegister(void)
void JsonArpLogRegister(void)
TmEcode JsonLogThreadDeinit(ThreadVars *t, void *data)
void AlertDebugLogRegister(void)
void OutputUnregisterFileRotationFlag(int *flag)
Unregister a file rotation flag.
AppProto alproto
application level protocol
void OutputFiledataLoggerRegister(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 *)