suricata
util-debug.h File Reference
#include "suricata-common.h"
#include "threads.h"
#include "util-error.h"
#include "util-debug-filters.h"
Include dependency graph for util-debug.h:

Go to the source code of this file.

Data Structures

struct  SCLogOPBuffer_
 Structure to be used when log_level override support would be provided by the logging module. More...
 
struct  SCLogOPIfaceCtx_
 The output interface context for the logging module. More...
 
struct  SCLogInitData_
 Structure containing init data, that would be passed to SCInitDebugModule() More...
 
struct  SCLogConfig_
 Holds the config state used by the logging api. More...
 

Macros

#define SC_LOG_ENV_LOG_LEVEL   "SC_LOG_LEVEL"
 ENV vars that can be used to set the properties for the logging module. More...
 
#define SC_LOG_ENV_LOG_OP_IFACE   "SC_LOG_OP_IFACE"
 
#define SC_LOG_ENV_LOG_FILE   "SC_LOG_FILE"
 
#define SC_LOG_ENV_LOG_FACILITY   "SC_LOG_FACILITY"
 
#define SC_LOG_ENV_LOG_FORMAT   "SC_LOG_FORMAT"
 
#define SC_LOG_ENV_LOG_OP_FILTER   "SC_LOG_OP_FILTER"
 
#define SC_LOG_DEF_FILE_FORMAT   "[%i - %m] %z %d: %S: %M"
 
#define SC_LOG_DEF_LOG_FORMAT_REL_NOTICE   "%D: %S: %M"
 
#define SC_LOG_DEF_LOG_FORMAT_REL_INFO   "%d: %S: %M"
 
#define SC_LOG_DEF_LOG_FORMAT_REL_CONFIG   "[%i] %d: %S: %M"
 
#define SC_LOG_DEF_LOG_FORMAT_DEBUG   "%d: %S: %M [%n:%f:%l]"
 
#define SC_LOG_MAX_LOG_MSG_LEN   2048
 
#define SC_LOG_MAX_LOG_FORMAT_LEN   128
 
#define SC_LOG_DEF_LOG_LEVEL   SC_LOG_INFO
 
#define SC_LOG_DEF_LOG_OP_IFACE   SC_LOG_OP_IFACE_CONSOLE
 
#define SC_LOG_DEF_LOG_FILE   "suricata.log"
 
#define SC_LOG_DEF_SYSLOG_FACILITY_STR   "local0"
 
#define SC_LOG_DEF_SYSLOG_FACILITY   LOG_LOCAL0
 
#define SC_LOG_FMT_TIME   'z' /* Timestamp in RFC3339 like format */
 
#define SC_LOG_FMT_TIME_LEGACY   't' /* Timestamp in legacy format */
 
#define SC_LOG_FMT_PID   'p' /* PID */
 
#define SC_LOG_FMT_TID   'i' /* Thread ID */
 
#define SC_LOG_FMT_TM   'm' /* Thread module name */
 
#define SC_LOG_FMT_LOG_LEVEL   'd' /* Log level */
 
#define SC_LOG_FMT_LOG_SLEVEL   'D' /* Log level */
 
#define SC_LOG_FMT_FILE_NAME   'f' /* File name */
 
#define SC_LOG_FMT_LINE   'l' /* Line number */
 
#define SC_LOG_FMT_FUNCTION   'n' /* Function */
 
#define SC_LOG_FMT_SUBSYSTEM   'S' /* Subsystem name */
 
#define SC_LOG_FMT_THREAD_NAME   'T' /* thread name */
 
#define SC_LOG_FMT_MESSAGE   'M' /* log message body */
 
#define SC_LOG_FMT_PREFIX   '%'
 
#define SCLogInfo(...)   SCLog(SC_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 Macro used to log INFORMATIONAL messages. More...
 
#define SCLogInfoRaw(file, func, line, ...)   SCLog(SC_LOG_INFO, (file), (func), (line), _sc_module, __VA_ARGS__)
 
#define SCLogConfig(...)   SCLog(SC_LOG_CONFIG, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 
#define SCLogPerf(...)   SCLog(SC_LOG_PERF, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 
#define SCLogNotice(...)   SCLog(SC_LOG_NOTICE, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 Macro used to log NOTICE messages. More...
 
#define SCLogNoticeRaw(file, func, line, ...)   SCLog(SC_LOG_NOTICE, (file), (func), (line), _sc_module, __VA_ARGS__)
 
#define SCLogWarning(...)   SCLogErr(SC_LOG_WARNING, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 Macro used to log WARNING messages. More...
 
#define SCLogWarningRaw(file, func, line, ...)   SCLogErr(SC_LOG_WARNING, (file), (func), (line), _sc_module, __VA_ARGS__)
 
#define SCLogError(...)   SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
 Macro used to log ERROR messages. More...
 
#define SCLogErrorRaw(file, func, line, ...)   SCLogErr(SC_LOG_ERROR, (file), (func), (line), _sc_module, __VA_ARGS__)
 
#define SCLogDebug(...)   do { } while (0)
 
#define SCEnter(...)
 
#define SCReturn   return
 
#define SCReturnInt(x)   return x
 
#define SCReturnUInt(x)   return x
 
#define SCReturnDbl(x)   return x
 
#define SCReturnChar(x)   return x
 
#define SCReturnCharPtr(x)   return x
 
#define SCReturnCT(x, type)   return x
 
#define SCReturnPtr(x, type)   return x
 
#define SCReturnBool(x)   return x
 
#define SCReturnStruct(x)   return x
 
#define FatalError(...)
 
#define FatalErrorOnInit(...)
 Fatal error IF we're starting up, and configured to consider errors to be fatal errors. More...
 
#define BOOL2STR(b)   (b) ? "true" : "false"
 

Typedefs

typedef struct SCLogOPBuffer_ SCLogOPBuffer
 Structure to be used when log_level override support would be provided by the logging module. More...
 
typedef struct SCLogOPIfaceCtx_ SCLogOPIfaceCtx
 The output interface context for the logging module. More...
 
typedef struct SCLogInitData_ SCLogInitData
 Structure containing init data, that would be passed to SCInitDebugModule() More...
 
typedef struct SCLogConfig_ SCLogConfig
 Holds the config state used by the logging api. More...
 

Enumerations

enum  SCLogLevel {
  SC_LOG_NOTSET = -1, SC_LOG_NONE = 0, SC_LOG_ERROR, SC_LOG_WARNING,
  SC_LOG_NOTICE, SC_LOG_INFO, SC_LOG_PERF, SC_LOG_CONFIG,
  SC_LOG_DEBUG, SC_LOG_LEVEL_MAX
}
 The various log levels NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLevel() or it may result in logging to syslog with LOG_EMERG priority. More...
 
enum  SCLogOPIface { SC_LOG_OP_IFACE_CONSOLE, SC_LOG_OP_IFACE_FILE, SC_LOG_OP_IFACE_SYSLOG, SC_LOG_OP_IFACE_MAX }
 The various output interfaces supported. More...
 
enum  SCLogOPType { SC_LOG_OP_TYPE_REGULAR = 0, SC_LOG_OP_TYPE_JSON }
 

Functions

void SCLog (int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) ATTR_FMT_PRINTF(6
 
void void SCLogErr (int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) ATTR_FMT_PRINTF(6
 
SCLogInitDataSCLogAllocLogInitData (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 *, SCLogInitData *)
 Appends an output_interface to the output_interface list sent in head. More...
 
void SCLogInitLogModule (SCLogInitData *)
 Initializes the logging module. More...
 
void SCLogDeInitLogModule (void)
 De-Initializes the logging module. More...
 
SCError SCLogMessage (const SCLogLevel, const char *, const unsigned int, const char *, const char *, const char *message)
 Adds the global log_format to the outgoing buffer. More...
 
SCLogOPBufferSCLogAllocLogOPBuffer (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...
 
int SCLogDebugEnabled (void)
 Returns whether debug messages are enabled to be logged or not. More...
 
void SCLogRegisterTests (void)
 
void SCLogLoadConfig (int daemon, int verbose, uint32_t userid, uint32_t groupid)
 
SCLogLevel SCLogGetLogLevel (void)
 

Variables

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
 Used to indicate whether the logging module has been init or not. More...
 
int sc_log_module_cleaned
 Used to indicate whether the logging module has been cleaned or not. More...
 

Detailed Description

Macro Definition Documentation

◆ BOOL2STR

#define BOOL2STR (   b)    (b) ? "true" : "false"

Definition at line 528 of file util-debug.h.

◆ FatalError

#define FatalError (   ...)
Value:
do { \
SCLogError(__VA_ARGS__); \
exit(EXIT_FAILURE); \
} while (0)

Definition at line 503 of file util-debug.h.

◆ FatalErrorOnInit

#define FatalErrorOnInit (   ...)
Value:
do { \
SC_ATOMIC_EXTERN(unsigned int, engine_stage); \
int init_errors_fatal = 0; \
(void)ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \
if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) { \
SCLogError(__VA_ARGS__); \
exit(EXIT_FAILURE); \
} \
SCLogWarning(__VA_ARGS__); \
} while (0)

Fatal error IF we're starting up, and configured to consider errors to be fatal errors.

Definition at line 512 of file util-debug.h.

◆ SC_LOG_DEF_FILE_FORMAT

#define SC_LOG_DEF_FILE_FORMAT   "[%i - %m] %z %d: %S: %M"

Definition at line 78 of file util-debug.h.

◆ SC_LOG_DEF_LOG_FILE

#define SC_LOG_DEF_LOG_FILE   "suricata.log"

Definition at line 97 of file util-debug.h.

◆ SC_LOG_DEF_LOG_FORMAT_DEBUG

#define SC_LOG_DEF_LOG_FORMAT_DEBUG   "%d: %S: %M [%n:%f:%l]"

Definition at line 82 of file util-debug.h.

◆ SC_LOG_DEF_LOG_FORMAT_REL_CONFIG

#define SC_LOG_DEF_LOG_FORMAT_REL_CONFIG   "[%i] %d: %S: %M"

Definition at line 81 of file util-debug.h.

◆ SC_LOG_DEF_LOG_FORMAT_REL_INFO

#define SC_LOG_DEF_LOG_FORMAT_REL_INFO   "%d: %S: %M"

Definition at line 80 of file util-debug.h.

◆ SC_LOG_DEF_LOG_FORMAT_REL_NOTICE

#define SC_LOG_DEF_LOG_FORMAT_REL_NOTICE   "%D: %S: %M"

Definition at line 79 of file util-debug.h.

◆ SC_LOG_DEF_LOG_LEVEL

#define SC_LOG_DEF_LOG_LEVEL   SC_LOG_INFO

Definition at line 91 of file util-debug.h.

◆ SC_LOG_DEF_LOG_OP_IFACE

#define SC_LOG_DEF_LOG_OP_IFACE   SC_LOG_OP_IFACE_CONSOLE

Definition at line 94 of file util-debug.h.

◆ SC_LOG_DEF_SYSLOG_FACILITY

#define SC_LOG_DEF_SYSLOG_FACILITY   LOG_LOCAL0

Definition at line 101 of file util-debug.h.

◆ SC_LOG_DEF_SYSLOG_FACILITY_STR

#define SC_LOG_DEF_SYSLOG_FACILITY_STR   "local0"

Definition at line 100 of file util-debug.h.

◆ SC_LOG_ENV_LOG_FACILITY

#define SC_LOG_ENV_LOG_FACILITY   "SC_LOG_FACILITY"

Definition at line 40 of file util-debug.h.

◆ SC_LOG_ENV_LOG_FILE

#define SC_LOG_ENV_LOG_FILE   "SC_LOG_FILE"

Definition at line 39 of file util-debug.h.

◆ SC_LOG_ENV_LOG_FORMAT

#define SC_LOG_ENV_LOG_FORMAT   "SC_LOG_FORMAT"

Definition at line 41 of file util-debug.h.

◆ SC_LOG_ENV_LOG_LEVEL

#define SC_LOG_ENV_LOG_LEVEL   "SC_LOG_LEVEL"

ENV vars that can be used to set the properties for the logging module.

Definition at line 37 of file util-debug.h.

◆ SC_LOG_ENV_LOG_OP_FILTER

#define SC_LOG_ENV_LOG_OP_FILTER   "SC_LOG_OP_FILTER"

Definition at line 42 of file util-debug.h.

◆ SC_LOG_ENV_LOG_OP_IFACE

#define SC_LOG_ENV_LOG_OP_IFACE   "SC_LOG_OP_IFACE"

Definition at line 38 of file util-debug.h.

◆ SC_LOG_FMT_FILE_NAME

#define SC_LOG_FMT_FILE_NAME   'f' /* File name */

Definition at line 195 of file util-debug.h.

◆ SC_LOG_FMT_FUNCTION

#define SC_LOG_FMT_FUNCTION   'n' /* Function */

Definition at line 197 of file util-debug.h.

◆ SC_LOG_FMT_LINE

#define SC_LOG_FMT_LINE   'l' /* Line number */

Definition at line 196 of file util-debug.h.

◆ SC_LOG_FMT_LOG_LEVEL

#define SC_LOG_FMT_LOG_LEVEL   'd' /* Log level */

Definition at line 193 of file util-debug.h.

◆ SC_LOG_FMT_LOG_SLEVEL

#define SC_LOG_FMT_LOG_SLEVEL   'D' /* Log level */

Definition at line 194 of file util-debug.h.

◆ SC_LOG_FMT_MESSAGE

#define SC_LOG_FMT_MESSAGE   'M' /* log message body */

Definition at line 200 of file util-debug.h.

◆ SC_LOG_FMT_PID

#define SC_LOG_FMT_PID   'p' /* PID */

Definition at line 190 of file util-debug.h.

◆ SC_LOG_FMT_PREFIX

#define SC_LOG_FMT_PREFIX   '%'

Definition at line 203 of file util-debug.h.

◆ SC_LOG_FMT_SUBSYSTEM

#define SC_LOG_FMT_SUBSYSTEM   'S' /* Subsystem name */

Definition at line 198 of file util-debug.h.

◆ SC_LOG_FMT_THREAD_NAME

#define SC_LOG_FMT_THREAD_NAME   'T' /* thread name */

Definition at line 199 of file util-debug.h.

◆ SC_LOG_FMT_TID

#define SC_LOG_FMT_TID   'i' /* Thread ID */

Definition at line 191 of file util-debug.h.

◆ SC_LOG_FMT_TIME

#define SC_LOG_FMT_TIME   'z' /* Timestamp in RFC3339 like format */

Definition at line 188 of file util-debug.h.

◆ SC_LOG_FMT_TIME_LEGACY

#define SC_LOG_FMT_TIME_LEGACY   't' /* Timestamp in legacy format */

Definition at line 189 of file util-debug.h.

◆ SC_LOG_FMT_TM

#define SC_LOG_FMT_TM   'm' /* Thread module name */

Definition at line 192 of file util-debug.h.

◆ SC_LOG_MAX_LOG_FORMAT_LEN

#define SC_LOG_MAX_LOG_FORMAT_LEN   128

Definition at line 88 of file util-debug.h.

◆ SC_LOG_MAX_LOG_MSG_LEN

#define SC_LOG_MAX_LOG_MSG_LEN   2048

Definition at line 85 of file util-debug.h.

◆ SCEnter

#define SCEnter (   ...)

Definition at line 272 of file util-debug.h.

◆ SCLogConfig

#define SCLogConfig (   ...)    SCLog(SC_LOG_CONFIG, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Definition at line 229 of file util-debug.h.

◆ SCLogDebug

#define SCLogDebug (   ...)    do { } while (0)

Definition at line 270 of file util-debug.h.

◆ SCLogError

#define SCLogError (   ...)    SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Macro used to log ERROR messages.

Return values
err_codeError code that has to be logged along with the error message
...Takes as argument(s), a printf style format message

Definition at line 262 of file util-debug.h.

◆ SCLogErrorRaw

#define SCLogErrorRaw (   file,
  func,
  line,
  ... 
)    SCLogErr(SC_LOG_ERROR, (file), (func), (line), _sc_module, __VA_ARGS__)

Definition at line 264 of file util-debug.h.

◆ SCLogInfo

#define SCLogInfo (   ...)    SCLog(SC_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Macro used to log INFORMATIONAL messages.

Return values
...Takes as argument(s), a printf style format message

Definition at line 225 of file util-debug.h.

◆ SCLogInfoRaw

#define SCLogInfoRaw (   file,
  func,
  line,
  ... 
)    SCLog(SC_LOG_INFO, (file), (func), (line), _sc_module, __VA_ARGS__)

Definition at line 226 of file util-debug.h.

◆ SCLogNotice

#define SCLogNotice (   ...)    SCLog(SC_LOG_NOTICE, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Macro used to log NOTICE messages.

Return values
...Takes as argument(s), a printf style format message

Definition at line 238 of file util-debug.h.

◆ SCLogNoticeRaw

#define SCLogNoticeRaw (   file,
  func,
  line,
  ... 
)    SCLog(SC_LOG_NOTICE, (file), (func), (line), _sc_module, __VA_ARGS__)

Definition at line 240 of file util-debug.h.

◆ SCLogPerf

#define SCLogPerf (   ...)    SCLog(SC_LOG_PERF, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Definition at line 231 of file util-debug.h.

◆ SCLogWarning

#define SCLogWarning (   ...)    SCLogErr(SC_LOG_WARNING, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)

Macro used to log WARNING messages.

Return values
err_codeError code that has to be logged along with the warning message
...Takes as argument(s), a printf style format message

Definition at line 250 of file util-debug.h.

◆ SCLogWarningRaw

#define SCLogWarningRaw (   file,
  func,
  line,
  ... 
)    SCLogErr(SC_LOG_WARNING, (file), (func), (line), _sc_module, __VA_ARGS__)

Definition at line 252 of file util-debug.h.

◆ SCReturn

#define SCReturn   return

Definition at line 274 of file util-debug.h.

◆ SCReturnBool

#define SCReturnBool (   x)    return x

Definition at line 290 of file util-debug.h.

◆ SCReturnChar

#define SCReturnChar (   x)    return x

Definition at line 282 of file util-debug.h.

◆ SCReturnCharPtr

#define SCReturnCharPtr (   x)    return x

Definition at line 284 of file util-debug.h.

◆ SCReturnCT

#define SCReturnCT (   x,
  type 
)    return x

Definition at line 286 of file util-debug.h.

◆ SCReturnDbl

#define SCReturnDbl (   x)    return x

Definition at line 280 of file util-debug.h.

◆ SCReturnInt

#define SCReturnInt (   x)    return x

Definition at line 276 of file util-debug.h.

◆ SCReturnPtr

#define SCReturnPtr (   x,
  type 
)    return x

Definition at line 288 of file util-debug.h.

◆ SCReturnStruct

#define SCReturnStruct (   x)    return x

Definition at line 292 of file util-debug.h.

◆ SCReturnUInt

#define SCReturnUInt (   x)    return x

Definition at line 278 of file util-debug.h.

Typedef Documentation

◆ SCLogConfig

typedef struct SCLogConfig_ SCLogConfig

Holds the config state used by the logging api.

◆ SCLogInitData

typedef struct SCLogInitData_ SCLogInitData

Structure containing init data, that would be passed to SCInitDebugModule()

◆ SCLogOPBuffer

typedef struct SCLogOPBuffer_ SCLogOPBuffer

Structure to be used when log_level override support would be provided by the logging module.

◆ SCLogOPIfaceCtx

The output interface context for the logging module.

Enumeration Type Documentation

◆ SCLogLevel

enum SCLogLevel

The various log levels NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLevel() or it may result in logging to syslog with LOG_EMERG priority.

Enumerator
SC_LOG_NOTSET 
SC_LOG_NONE 
SC_LOG_ERROR 
SC_LOG_WARNING 
SC_LOG_NOTICE 
SC_LOG_INFO 
SC_LOG_PERF 
SC_LOG_CONFIG 
SC_LOG_DEBUG 
SC_LOG_LEVEL_MAX 

Definition at line 48 of file util-debug.h.

◆ SCLogOPIface

The various output interfaces supported.

Enumerator
SC_LOG_OP_IFACE_CONSOLE 
SC_LOG_OP_IFACE_FILE 
SC_LOG_OP_IFACE_SYSLOG 
SC_LOG_OP_IFACE_MAX 

Definition at line 64 of file util-debug.h.

◆ SCLogOPType

Enumerator
SC_LOG_OP_TYPE_REGULAR 
SC_LOG_OP_TYPE_JSON 

Definition at line 71 of file util-debug.h.

Function Documentation

◆ SCLog()

void SCLog ( int  x,
const char *  file,
const char *  func,
const int  line,
const char *  module,
const char *  fmt,
  ... 
)

◆ SCLogAllocLogInitData()

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.

Return values
sc_lidPointer to the newly created SCLogInitData \initonly

Definition at line 1250 of file util-debug.c.

References SCCalloc.

Referenced by SCLogLoadConfig().

Here is the caller graph for this function:

◆ SCLogAllocLogOPBuffer()

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.

Return values
bufferPointer to the newly created output_buffer

Definition at line 786 of file util-debug.c.

References SCMalloc.

◆ SCLogAppendOPIfaceCtx()

void SCLogAppendOPIfaceCtx ( SCLogOPIfaceCtx iface_ctx,
SCLogInitData sc_lid 
)

Appends an output_interface to the output_interface list sent in head.

Parameters
iface_ctxPointer to the output_interface that has to be added to head
headPointer 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.

◆ SCLogDebugEnabled()

int SCLogDebugEnabled ( void  )

Returns whether debug messages are enabled to be logged or not.

Return values
1if debug messages are enabled to be logged
0if 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().

Here is the caller graph for this function:

◆ SCLogDeInitLogModule()

void SCLogDeInitLogModule ( void  )

De-Initializes the logging module.

Definition at line 1597 of file util-debug.c.

Referenced by GlobalsDestroy(), and SCLogInitLogModule().

Here is the caller graph for this function:

◆ SCLogErr()

void void SCLogErr ( int  x,
const char *  file,
const char *  func,
const int  line,
const char *  module,
const char *  fmt,
  ... 
)

◆ SCLogGetLogLevel()

SCLogLevel SCLogGetLogLevel ( void  )

Definition at line 1070 of file util-debug.c.

References sc_log_global_log_level.

◆ SCLogInitLogModule()

void SCLogInitLogModule ( SCLogInitData sc_lid)

Initializes the logging module.

Parameters
sc_lidThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SCLogLoadConfig()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SCLogMessage()

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.

Parameters
log_levellog_level of the message that has to be logged
msgBuffer containing the outgoing message
fileFile_name from where the message originated
functionFunction_name from where the message originated
lineLine_no from where the messaged originated
Return values
SC_OKon 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().

Here is the caller graph for this function:

◆ SCLogRegisterTests()

void SCLogRegisterTests ( void  )

Definition at line 1799 of file util-debug.c.

References UtRegisterTest().

Here is the call graph for this function:

Variable Documentation

◆ sc_log_global_log_level

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().

◆ sc_log_module_cleaned

int sc_log_module_cleaned

Used to indicate whether the logging module has been cleaned or not.

Definition at line 111 of file util-debug.c.

◆ sc_log_module_initialized

int sc_log_module_initialized

Used to indicate whether the logging module has been init or not.

Definition at line 106 of file util-debug.c.

Referenced by SCLogMessage().

ConfGetBool
int ConfGetBool(const char *name, int *val)
Retrieve a configuration value as a boolean.
Definition: conf.c:482
SURICATA_INIT
@ SURICATA_INIT
Definition: suricata.h:95
SC_ATOMIC_GET
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
Definition: util-atomic.h:375