Go to the documentation of this file.
106 typedef struct LoggerThreadStoreNode_ {
111 typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_) LoggerThreadStore;
121 typedef struct OutputFileRolloverFlag_ {
127 TAILQ_HEAD(, OutputFileRolloverFlag_) output_file_rotation_flags =
153 SCLogDebug(
"Output module \"%s\" registered.", name);
158 FatalError(
"Fatal error encountered in OutputRegisterModule. Exiting...");
175 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
195 SCLogDebug(
"Packet logger \"%s\" registered.", name);
198 FatalError(
"Fatal error encountered. Exiting...");
215 if (
unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
236 SCLogDebug(
"Packet logger \"%s\" registered.", name);
239 FatalError(
"Fatal error encountered. Exiting...");
250 static void OutputRegisterTxModuleWrapper(
LoggerId id,
const char *name,
252 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
280 SCLogDebug(
"Tx logger \"%s\" registered.", name);
283 FatalError(
"Fatal error encountered. Exiting...");
286 static void OutputRegisterTxSubModuleWrapper(
LoggerId id,
const char *parent_name,
317 SCLogDebug(
"Tx logger for alproto %d \"%s\" registered.", alproto, name);
320 FatalError(
"Fatal error encountered. Exiting...");
337 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
338 TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
339 ThreadExitPrintStats);
343 const char *parent_name,
const char *name,
const char *conf_name,
349 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
350 alproto, TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
351 ThreadExitPrintStats);
364 TxLogger TxLogFunc,
int tc_log_progress,
int ts_log_progress,
368 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
369 TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
370 ThreadDeinit, ThreadExitPrintStats);
380 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name, InitFunc,
381 alproto, TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
382 ThreadDeinit, ThreadExitPrintStats);
399 OutputRegisterTxModuleWrapper(
id, name, conf_name, InitFunc, alproto,
400 TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
401 ThreadExitPrintStats);
405 const char *name,
const char *conf_name,
410 OutputRegisterTxSubModuleWrapper(
id, parent_name, name, conf_name,
411 InitFunc, alproto, TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
412 ThreadExitPrintStats);
429 if (
unlikely(FileLogFunc == NULL)) {
449 SCLogDebug(
"File logger \"%s\" registered.", name);
452 FatalError(
"Fatal error encountered. Exiting...");
469 if (
unlikely(FiledataLogFunc == NULL)) {
488 SCLogDebug(
"Filedata logger \"%s\" registered.", name);
491 FatalError(
"Fatal error encountered. Exiting...");
508 if (
unlikely(FlowLogFunc == NULL)) {
528 SCLogDebug(
"Flow logger \"%s\" registered.", name);
531 FatalError(
"Fatal error encountered. Exiting...");
549 if (
unlikely(StreamingLogFunc == NULL)) {
569 SCLogDebug(
"Streaming logger \"%s\" registered.", name);
572 FatalError(
"Fatal error encountered. Exiting...");
588 if (
unlikely(StatsLogFunc == NULL)) {
607 SCLogDebug(
"Stats logger \"%s\" registered.", name);
610 FatalError(
"Fatal error encountered. Exiting...");
627 if (
unlikely(StatsLogFunc == NULL)) {
647 SCLogDebug(
"Stats logger \"%s\" registered.", name);
650 FatalError(
"Fatal error encountered. Exiting...");
664 if (strcmp(module->
conf_name, conf_name) == 0)
684 static int drop_loggers = 0;
710 SCLogError(
"Failed to allocate memory to register file rotation flag");
713 flag_entry->flag = flag;
730 for (entry =
TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;
733 if (entry->flag == flag) {
734 TAILQ_REMOVE(&output_file_rotation_flags, entry, entries);
753 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
756 while (logger && thread_store_node) {
757 logger->
LogFunc(
tv, p, thread_store_node->thread_data);
760 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
767 LoggerThreadStore *thread_store =
SCCalloc(1,
sizeof(*thread_store));
768 if (thread_store == NULL) {
772 *data = (
void *)thread_store;
777 void *child_thread_data = NULL;
781 SCCalloc(1,
sizeof(*thread_store_node));
782 if (thread_store_node == NULL) {
788 thread_store_node->thread_data = child_thread_data;
798 if (thread_data == NULL)
801 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
804 while (logger && thread_store_node) {
809 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
813 while ((thread_store_node =
TAILQ_FIRST(thread_store)) != NULL) {
815 SCFree(thread_store_node);
824 LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
827 while (logger && thread_store_node) {
832 thread_store_node =
TAILQ_NEXT(thread_store_node, entries);
844 if (logger == NULL) {
855 static void OutputRegisterActiveLogger(
RootLogger *reg)
858 if (logger == NULL) {
875 OutputRegisterActiveLogger(logger);
885 while ((logger =
TAILQ_FIRST(&active_loggers)) != NULL) {
910 void *state,
void *tx, uint64_t tx_id,
int dir)
930 name =
"bittorrent_dht";
940 if (!al->
LogTx(tx, js)) {
955 void *state,
void *tx, uint64_t tx_id)
957 return JsonGenericLogger(
tv, thread_data, p, f, state, tx, tx_id,
LOG_DIR_PACKET);
961 void *state,
void *tx, uint64_t tx_id)
963 return JsonGenericLogger(
tv, thread_data, p, f, state, tx, tx_id,
LOG_DIR_FLOW);
1013 SCLogDebug(
"modbus json logger registered.");
1104 if (
ConfGetNode(
"app-layer.protocols.bittorrent-dht") != NULL) {
1157 BUG_ON(simple_json_applayer_loggers[alproto].
proto != alproto);
1158 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 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
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)
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 *)