suricata
|
#include "suricata-common.h"
#include "util-debug.h"
#include "output.h"
#include "suricata.h"
#include "util-conf.h"
#include "util-enum.h"
#include "util-path.h"
#include "util-syslog.h"
#include "util-time.h"
Go to the source code of this file.
Functions | |
SCError | SCLogMessage (const SCLogLevel log_level, const char *file, const unsigned int line, const char *function, const char *module, const char *message) |
Adds the global log_format to the outgoing buffer. More... | |
void | SCLog (int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) |
void | SCLogErr (int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) |
int | SCLogDebugEnabled (void) |
Returns whether debug messages are enabled to be logged or not. More... | |
SCLogOPBuffer * | SCLogAllocLogOPBuffer (void) |
Allocates an output buffer for an output interface. Used when we want the op_interface log_format to override the global_log_format. Currently not used. More... | |
SCLogLevel | SCLogGetLogLevel (void) |
SCLogInitData * | SCLogAllocLogInitData (void) |
Returns a pointer to a new SCLogInitData. This is a public interface intended to be used after the logging parameters are read from the conf file. More... | |
void | SCLogAppendOPIfaceCtx (SCLogOPIfaceCtx *iface_ctx, SCLogInitData *sc_lid) |
Appends an output_interface to the output_interface list sent in head. More... | |
void | SCLogInitLogModule (SCLogInitData *sc_lid) |
Initializes the logging module. More... | |
void | SCLogLoadConfig (int daemon, int verbose, uint32_t userid, uint32_t groupid) |
void | SCLogDeInitLogModule (void) |
De-Initializes the logging module. More... | |
void | SCLogRegisterTests (void) |
Variables | |
SCEnumCharMap | sc_log_level_map [] |
SCEnumCharMap | sc_log_slevel_map [] |
SCEnumCharMap | sc_log_op_iface_map [] |
SCLogLevel | sc_log_global_log_level |
Holds the global log level. Is the same as sc_log_config->log_level. More... | |
int | sc_log_module_initialized = 0 |
Used to indicate whether the logging module has been init or not. More... | |
int | sc_log_module_cleaned = 0 |
Used to indicate whether the logging module has been cleaned or not. More... | |
Debug utility functions
Definition in file util-debug.c.
void SCLog | ( | int | x, |
const char * | file, | ||
const char * | func, | ||
const int | line, | ||
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 723 of file util-debug.c.
References msg, sc_log_fd_filters_present, sc_log_fg_filters_present, sc_log_global_log_level, SC_LOG_MAX_LOG_MSG_LEN, SCLogMatchFDFilter(), SCLogMatchFGFilterBL(), SCLogMatchFGFilterWL(), and SCLogMessage().
SCLogInitData* SCLogAllocLogInitData | ( | void | ) |
Returns a pointer to a new SCLogInitData. This is a public interface intended to be used after the logging parameters are read from the conf file.
sc_lid | Pointer to the newly created SCLogInitData \initonly |
Definition at line 1250 of file util-debug.c.
References SCCalloc.
Referenced by SCLogLoadConfig().
SCLogOPBuffer* SCLogAllocLogOPBuffer | ( | void | ) |
Allocates an output buffer for an output interface. Used when we want the op_interface log_format to override the global_log_format. Currently not used.
buffer | Pointer to the newly created output_buffer |
Definition at line 786 of file util-debug.c.
References SCMalloc.
void SCLogAppendOPIfaceCtx | ( | SCLogOPIfaceCtx * | iface_ctx, |
SCLogInitData * | sc_lid | ||
) |
Appends an output_interface to the output_interface list sent in head.
iface_ctx | Pointer to the output_interface that has to be added to head |
head | Pointer to the output_interface list |
Definition at line 1306 of file util-debug.c.
References head, SCLogOPIfaceCtx_::next, SCLogInitData_::op_ifaces, and SCLogInitData_::op_ifaces_cnt.
int SCLogDebugEnabled | ( | void | ) |
Returns whether debug messages are enabled to be logged or not.
1 | if debug messages are enabled to be logged |
0 | if debug messages are not enabled to be logged |
Definition at line 767 of file util-debug.c.
References SC_LOG_DEBUG, and sc_log_global_log_level.
Referenced by FlowVarPrint().
void SCLogDeInitLogModule | ( | void | ) |
De-Initializes the logging module.
Definition at line 1597 of file util-debug.c.
Referenced by GlobalsDestroy(), and SCLogInitLogModule().
void SCLogErr | ( | int | x, |
const char * | file, | ||
const char * | func, | ||
const int | line, | ||
const char * | module, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 742 of file util-debug.c.
References msg, sc_log_fd_filters_present, sc_log_fg_filters_present, sc_log_global_log_level, SC_LOG_MAX_LOG_MSG_LEN, SCLogMatchFDFilter(), SCLogMatchFGFilterBL(), SCLogMatchFGFilterWL(), and SCLogMessage().
SCLogLevel SCLogGetLogLevel | ( | void | ) |
Definition at line 1070 of file util-debug.c.
References sc_log_global_log_level.
void SCLogInitLogModule | ( | SCLogInitData * | sc_lid | ) |
Initializes the logging module.
sc_lid | The initialization data for the logging module. If sc_lid is NULL, we would stick to the default configuration for the logging subsystem. \initonly |
Definition at line 1390 of file util-debug.c.
References FatalError, SCLogDeInitLogModule(), and SCMutexInit.
Referenced by InitGlobal().
void SCLogLoadConfig | ( | int | daemon, |
int | verbose, | ||
uint32_t | userid, | ||
uint32_t | groupid | ||
) |
Definition at line 1420 of file util-debug.c.
References ConfGet(), ConfGetNode(), SCLogInitData_::global_log_format, SCLogInitData_::global_log_level, MAX, sc_log_level_map, SC_LOG_NOTICE, SCLogAllocLogInitData(), SCLogDebug, SCLogError, and SCMapEnumNameToValue().
Referenced by ListAppLayerProtocols(), and ListKeywords().
SCError SCLogMessage | ( | const SCLogLevel | log_level, |
const char * | file, | ||
const unsigned int | line, | ||
const char * | function, | ||
const char * | module, | ||
const char * | message | ||
) |
Adds the global log_format to the outgoing buffer.
log_level | log_level of the message that has to be logged |
msg | Buffer containing the outgoing message |
file | File_name from where the message originated |
function | Function_name from where the message originated |
line | Line_no from where the messaged originated |
SC_OK | on success; else an error code |
Definition at line 652 of file util-debug.c.
References SC_LOG_MAX_LOG_MSG_LEN, sc_log_module_initialized, SC_OK, SCTIME_FROM_TIMEVAL, and ts.
Referenced by SCLog(), and SCLogErr().
void SCLogRegisterTests | ( | void | ) |
Definition at line 1799 of file util-debug.c.
References UtRegisterTest().
SCLogLevel sc_log_global_log_level |
Holds the global log level. Is the same as sc_log_config->log_level.
Definition at line 101 of file util-debug.c.
Referenced by SCLog(), SCLogDebugEnabled(), SCLogErr(), and SCLogGetLogLevel().
SCEnumCharMap sc_log_level_map[] |
Definition at line 41 of file util-debug.c.
Referenced by SCLogLoadConfig().
int sc_log_module_cleaned = 0 |
Used to indicate whether the logging module has been cleaned or not.
Definition at line 111 of file util-debug.c.
int sc_log_module_initialized = 0 |
Used to indicate whether the logging module has been init or not.
Definition at line 106 of file util-debug.c.
Referenced by SCLogAddFDFilter(), SCLogCheckFDFilterEntry(), SCLogCheckFDFilterExit(), SCLogMatchFDFilter(), SCLogMessage(), SCLogPrintFDFilters(), SCLogPrintFGFilters(), and SCLogRemoveFDFilter().
SCEnumCharMap sc_log_op_iface_map[] |
Definition at line 68 of file util-debug.c.
SCEnumCharMap sc_log_slevel_map[] |
Definition at line 54 of file util-debug.c.