suricata
|
#include "decode.h"
#include "tm-modules.h"
#include "output-packet.h"
#include "output-tx.h"
#include "output-file.h"
#include "output-filedata.h"
#include "output-flow.h"
#include "output-streaming.h"
#include "output-stats.h"
Go to the source code of this file.
Data Structures | |
struct | OutputLoggerThreadStore_ |
struct | OutputInitResult_ |
struct | OutputModule_ |
struct | OutputPacketLoggerFunctions_ |
Macros | |
#define | DEFAULT_LOG_MODE_APPEND "yes" |
#define | DEFAULT_LOG_FILETYPE "regular" |
Typedefs | |
typedef struct OutputLoggerThreadStore_ | OutputLoggerThreadStore |
typedef struct OutputInitResult_ | OutputInitResult |
typedef OutputInitResult(* | OutputInitFunc) (SCConfNode *) |
typedef OutputInitResult(* | OutputInitSubFunc) (SCConfNode *, OutputCtx *) |
typedef TmEcode(* | OutputLogFunc) (ThreadVars *, Packet *, void *) |
typedef TmEcode(* | OutputFlushFunc) (ThreadVars *, Packet *, void *) |
typedef uint32_t(* | OutputGetActiveCountFunc) (void) |
typedef struct OutputModule_ | OutputModule |
typedef struct OutputPacketLoggerFunctions_ | OutputPacketLoggerFunctions |
typedef void(* | SCOnLoggingReadyCallback) (void *arg) |
Functions | |
typedef | TAILQ_HEAD (OutputModuleList_, OutputModule_) OutputModuleList |
void | OutputRegisterModule (const char *, const char *, OutputInitFunc) |
void | OutputRegisterPacketModule (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, OutputPacketLoggerFunctions *) |
Register a packet output module. | |
void | OutputRegisterPacketSubModule (LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, OutputPacketLoggerFunctions *) |
Register a packet output sub-module. | |
void | OutputRegisterTxModule (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a tx output module. | |
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) |
void | OutputRegisterTxModuleWithCondition (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a tx output module with condition. | |
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) |
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) |
Register a tx output module with progress. | |
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) |
void | OutputRegisterFileSubModule (LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, SCFileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a file output sub-module. | |
void | OutputRegisterFiledataModule (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, SCFiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a file data output module. | |
void | OutputRegisterFlowSubModule (LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a flow output sub-module. | |
void | OutputRegisterStreamingModule (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, SCStreamingLogger StreamingLogFunc, enum SCOutputStreamingType stream_type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a streaming data output module. | |
void | OutputRegisterStatsModule (LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a stats data output module. | |
void | OutputRegisterStatsSubModule (LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit) |
Register a stats data output sub-module. | |
OutputModule * | OutputGetModuleByConfName (const char *name) |
Get an output module by name. | |
void | OutputDeregisterAll (void) |
Deregister all modules. Useful for a memory clean exit. | |
int | OutputDropLoggerEnable (void) |
void | OutputDropLoggerDisable (void) |
void | OutputRegisterFileRotationFlag (int *flag) |
Register a flag for file rotation notification. | |
void | OutputUnregisterFileRotationFlag (int *flag) |
Unregister a file rotation flag. | |
void | OutputNotifyFileRotation (void) |
Notifies all registered file rotation notification flags. | |
int | SCRegisterOnLoggingReady (SCOnLoggingReadyCallback callback, void *arg) |
Register a callback to be called when logging is ready. | |
void | SCOnLoggingReady (void) |
Invokes all registered logging ready callbacks. | |
void | OutputRegisterRootLogger (ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc) |
void | TmModuleLoggerRegister (void) |
TmEcode | OutputLoggerLog (ThreadVars *, Packet *, void *) |
TmEcode | OutputLoggerFlush (ThreadVars *, Packet *, void *) |
TmEcode | OutputLoggerThreadInit (ThreadVars *, const void *, void **) |
TmEcode | OutputLoggerThreadDeinit (ThreadVars *, void *) |
void | OutputLoggerExitPrintStats (ThreadVars *, void *) |
void | OutputSetupActiveLoggers (void) |
void | OutputClearActiveLoggers (void) |
Variables | |
OutputModuleList | output_modules |
Definition in file output.h.
typedef TmEcode(* OutputFlushFunc) (ThreadVars *, Packet *, void *) |
typedef OutputInitResult(* OutputInitFunc) (SCConfNode *) |
typedef struct OutputInitResult_ OutputInitResult |
typedef OutputInitResult(* OutputInitSubFunc) (SCConfNode *, OutputCtx *) |
typedef TmEcode(* OutputLogFunc) (ThreadVars *, Packet *, void *) |
typedef struct OutputLoggerThreadStore_ OutputLoggerThreadStore |
typedef struct OutputModule_ OutputModule |
typedef struct OutputPacketLoggerFunctions_ OutputPacketLoggerFunctions |
void OutputClearActiveLoggers | ( | void | ) |
Definition at line 916 of file output.c.
References SCFree, TAILQ_FIRST, and TAILQ_REMOVE.
Referenced by RunModeShutDown().
void OutputDeregisterAll | ( | void | ) |
Deregister all modules. Useful for a memory clean exit.
Definition at line 658 of file output.c.
References output_modules, SCFree, TAILQ_FIRST, and TAILQ_REMOVE.
Referenced by GlobalsDestroy().
OutputModule * OutputGetModuleByConfName | ( | const char * | conf_name | ) |
Get an output module by name.
The | OutputModule with the given name or NULL if no output module with the given name is registered. |
Definition at line 641 of file output.c.
References output_modules, and TAILQ_FOREACH.
void OutputLoggerExitPrintStats | ( | ThreadVars * | , |
void * | |||
) |
TmEcode OutputLoggerFlush | ( | ThreadVars * | tv, |
Packet * | p, | ||
void * | thread_data | ||
) |
Definition at line 788 of file output.c.
References RootLogger_::FlushFunc, LoggerThreadStoreNode, TAILQ_FIRST, TAILQ_NEXT, TM_ECODE_OK, and tv.
TmEcode OutputLoggerLog | ( | ThreadVars * | tv, |
Packet * | p, | ||
void * | thread_data | ||
) |
Definition at line 803 of file output.c.
References RootLogger_::LogFunc, LoggerThreadStoreNode, TAILQ_FIRST, TAILQ_NEXT, TM_ECODE_OK, and tv.
TmEcode OutputLoggerThreadDeinit | ( | ThreadVars * | tv, |
void * | thread_data | ||
) |
Definition at line 848 of file output.c.
References LoggerThreadStoreNode, SCFree, TAILQ_FIRST, TAILQ_NEXT, TAILQ_REMOVE, RootLogger_::ThreadDeinit, TM_ECODE_FAILED, TM_ECODE_OK, and tv.
Referenced by OutputLoggerThreadInit().
TmEcode OutputLoggerThreadInit | ( | ThreadVars * | tv, |
const void * | initdata, | ||
void ** | data | ||
) |
Definition at line 817 of file output.c.
References LoggerThreadStoreNode, OutputLoggerThreadDeinit(), SCCalloc, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, RootLogger_::ThreadInit, TM_ECODE_FAILED, TM_ECODE_OK, and tv.
void OutputNotifyFileRotation | ( | void | ) |
Notifies all registered file rotation notification flags.
Definition at line 735 of file output.c.
References OutputFileRolloverFlag, SCMutexLock, SCMutexUnlock, and TAILQ_FOREACH_SAFE.
Referenced by SuricataMainLoop().
void OutputRegisterFiledataModule | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
SCFiledataLogger | FiledataLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a file data output module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 459 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by OutputFilestoreRegister().
void OutputRegisterFileRotationFlag | ( | int * | flag | ) |
Register a flag for file rotation notification.
flag | A pointer that will be set to 1 when file rotation is requested. |
Definition at line 692 of file output.c.
References OutputFileRolloverFlag, SCCalloc, SCLogError, SCMutexLock, SCMutexUnlock, TAILQ_INSERT_TAIL, and unlikely.
Referenced by SCConfLogOpenGeneric().
void OutputRegisterFileSubModule | ( | LoggerId | id, |
const char * | parent_name, | ||
const char * | name, | ||
const char * | conf_name, | ||
OutputInitSubFunc | InitFunc, | ||
SCFileLogger | FileLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a file output sub-module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 422 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by JsonFileLogRegister().
void OutputRegisterFlowSubModule | ( | LoggerId | id, |
const char * | parent_name, | ||
const char * | name, | ||
const char * | conf_name, | ||
OutputInitSubFunc | InitFunc, | ||
FlowLogger | FlowLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a flow output sub-module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 495 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by JsonFlowLogRegister(), and JsonNetFlowLogRegister().
void OutputRegisterModule | ( | const char * | , |
const char * | , | ||
OutputInitFunc | |||
) |
Referenced by LuaLogRegister(), and OutputJsonRegister().
void OutputRegisterPacketModule | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
OutputPacketLoggerFunctions * | output_module_functions | ||
) |
Register a packet output module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 196 of file output.c.
References OutputPacketLoggerFunctions_::ConditionFunc, FatalError, OutputPacketLoggerFunctions_::LogFunc, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by AlertDebugLogRegister(), AlertFastLogRegister(), AlertSyslogRegister(), and PcapLogRegister().
void OutputRegisterPacketSubModule | ( | LoggerId | id, |
const char * | parent_name, | ||
const char * | name, | ||
const char * | conf_name, | ||
OutputInitSubFunc | InitFunc, | ||
OutputPacketLoggerFunctions * | output_logger_functions | ||
) |
Register a packet output sub-module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 234 of file output.c.
References OutputPacketLoggerFunctions_::ConditionFunc, FatalError, OutputPacketLoggerFunctions_::LogFunc, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by EveStreamLogRegister(), JsonAlertLogRegister(), JsonAnomalyLogRegister(), JsonArpLogRegister(), JsonDropLogRegister(), JsonFrameLogRegister(), and JsonMetadataLogRegister().
void OutputRegisterRootLogger | ( | ThreadInitFunc | ThreadInit, |
ThreadDeinitFunc | ThreadDeinit, | ||
OutputLogFunc | LogFunc, | ||
OutputGetActiveCountFunc | ActiveCntFunc | ||
) |
Definition at line 874 of file output.c.
References RootLogger_::ActiveCntFunc, BUG_ON, FatalError, RootLogger_::LogFunc, SCCalloc, TAILQ_INSERT_TAIL, RootLogger_::ThreadDeinit, and RootLogger_::ThreadInit.
Referenced by OutputPacketLoggerRegister(), OutputStreamingLoggerRegister(), and OutputTxLoggerRegister().
void OutputRegisterStatsModule | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
StatsLogger | StatsLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a stats data output module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 570 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by LogStatsLogRegister().
void OutputRegisterStatsSubModule | ( | LoggerId | id, |
const char * | parent_name, | ||
const char * | name, | ||
const char * | conf_name, | ||
OutputInitSubFunc | InitFunc, | ||
StatsLogger | StatsLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a stats data output sub-module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 606 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by JsonStatsLogRegister().
void OutputRegisterStreamingModule | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
SCStreamingLogger | StreamingLogFunc, | ||
enum SCOutputStreamingType | stream_type, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a streaming data output module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 532 of file output.c.
References FatalError, name, output_modules, SCLogDebug, TAILQ_INSERT_TAIL, and unlikely.
Referenced by LogTcpDataLogRegister().
void OutputRegisterTxModule | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
AppProto | alproto, | ||
TxLogger | TxLogFunc, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a tx output module.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 398 of file output.c.
References name.
Referenced by LogHttpLogRegister().
void OutputRegisterTxModuleWithCondition | ( | LoggerId | id, |
const char * | name, | ||
const char * | conf_name, | ||
OutputInitFunc | InitFunc, | ||
AppProto | alproto, | ||
TxLogger | TxLogFunc, | ||
TxLoggerCondition | TxLogCondition, | ||
ThreadInitFunc | ThreadInit, | ||
ThreadDeinitFunc | ThreadDeinit | ||
) |
Register a tx output module with condition.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 349 of file output.c.
References name.
Referenced by LogTlsStoreRegister().
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 | ||
) |
Register a tx output module with progress.
This function will register an output module so it can be configured with the configuration file.
Returns | 0 on success, -1 on failure. |
Definition at line 373 of file output.c.
References name.
Referenced by LogTlsLogRegister().
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 | ||
) |
Definition at line 406 of file output.c.
References name.
Referenced by JsonAnomalyLogRegister(), JsonDCERPCLogRegister(), JsonDHCPLogRegister(), JsonDNP3LogRegister(), JsonDnsLogRegister(), JsonDoh2LogRegister(), JsonHttpLogRegister(), JsonIKELogRegister(), JsonMdnsLogRegister(), JsonMQTTLogRegister(), JsonNFSLogRegister(), JsonPgsqlLogRegister(), JsonSMBLogRegister(), JsonSmtpLogRegister(), and OutputRegisterLoggers().
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 | ||
) |
Definition at line 357 of file output.c.
References name.
Referenced by OutputRegisterLoggers().
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 | ||
) |
Definition at line 381 of file output.c.
References name.
Referenced by JsonTlsLogRegister(), and OutputRegisterLoggers().
void OutputSetupActiveLoggers | ( | void | ) |
Definition at line 903 of file output.c.
References RootLogger_::ActiveCntFunc, cnt, TAILQ_FIRST, and TAILQ_NEXT.
Referenced by RunModeInitializeOutputs().
void OutputUnregisterFileRotationFlag | ( | int * | flag | ) |
Unregister a file rotation flag.
Note that it is safe to call this function with a flag that may not have been registered, in which case this function won't do anything.
flag | A pointer that has been previously registered for file rotation notifications. |
Definition at line 715 of file output.c.
References next, OutputFileRolloverFlag, SCFree, SCMutexLock, SCMutexUnlock, TAILQ_FIRST, TAILQ_NEXT, and TAILQ_REMOVE.
Referenced by LogFileFreeCtx().
void SCOnLoggingReady | ( | void | ) |
Invokes all registered logging ready callbacks.
This function should be called after the logging system has been fully initialized to notify all registered callbacks that logging is ready.
Definition at line 778 of file output.c.
References OnLoggingReadyCallbackNode, and TAILQ_FOREACH.
Referenced by SuricataInit().
int SCRegisterOnLoggingReady | ( | SCOnLoggingReadyCallback | callback, |
void * | arg | ||
) |
Register a callback to be called when logging is ready.
This function registers a callback that will be invoked when the logging system has been fully initialized. This is useful for both plugins and library users who need to register application transaction loggers after logging initialization is complete.
callback | The callback function to be called |
arg | An argument to be passed to the callback function |
Definition at line 757 of file output.c.
References OnLoggingReadyCallbackNode, SCCalloc, SCLogError, and TAILQ_INSERT_TAIL.
typedef TAILQ_HEAD | ( | OutputModuleList_ | , |
OutputModule_ | |||
) |
void TmModuleLoggerRegister | ( | void | ) |
Definition at line 925 of file output.c.
References OutputRegisterLoggers(), and OutputRegisterRootLoggers().
Referenced by RegisterAllModules().
|
extern |
Referenced by OutputDeregisterAll(), OutputGetModuleByConfName(), OutputRegisterFiledataModule(), OutputRegisterFileSubModule(), OutputRegisterFlowSubModule(), OutputRegisterPacketModule(), OutputRegisterPacketSubModule(), OutputRegisterStatsModule(), OutputRegisterStatsSubModule(), OutputRegisterStreamingModule(), and RunModeInitializeOutputs().