suricata
util-debug.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Anoop Saldanha <anoopsaldanha@gmail.com>
22  */
23 
24 #ifndef SURICATA_UTIL_DEBUG_H
25 #define SURICATA_UTIL_DEBUG_H
26 
27 /**
28  * \brief The various log levels
29  * NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLevel()
30  * or it may result in logging to syslog with LOG_EMERG priority.
31  */
32 typedef enum {
43 } SCLogLevel;
44 
45 #ifndef SURICATA_BINDGEN_H
46 #include "suricata-common.h"
47 
48 #include "threads.h"
49 #include "util-error.h"
50 #include "util-debug-filters.h"
51 
52 /**
53  * \brief ENV vars that can be used to set the properties for the logging module
54  */
55 #define SC_LOG_ENV_LOG_LEVEL "SC_LOG_LEVEL"
56 #define SC_LOG_ENV_LOG_OP_IFACE "SC_LOG_OP_IFACE"
57 #define SC_LOG_ENV_LOG_FILE "SC_LOG_FILE"
58 #define SC_LOG_ENV_LOG_FACILITY "SC_LOG_FACILITY"
59 #define SC_LOG_ENV_LOG_FORMAT "SC_LOG_FORMAT"
60 #define SC_LOG_ENV_LOG_OP_FILTER "SC_LOG_OP_FILTER"
61 
62 /**
63  * \brief The various output interfaces supported
64  */
65 typedef enum {
70 } SCLogOPIface;
71 
72 typedef enum {
75 } SCLogOPType;
76 
77 /* The default log_format, if it is not supplied by the user */
78 #define SC_LOG_DEF_FILE_FORMAT "[%i - %m] %z %d: %S: %M"
79 #define SC_LOG_DEF_LOG_FORMAT_REL_NOTICE "%D: %S: %M"
80 #define SC_LOG_DEF_LOG_FORMAT_REL_INFO "%d: %S: %M"
81 #define SC_LOG_DEF_LOG_FORMAT_REL_CONFIG "[%i] %d: %S: %M"
82 #define SC_LOG_DEF_LOG_FORMAT_DEBUG "%d: %S: %M [%n:%f:%l]"
83 
84 /* The maximum length of the log message: we add max rule size and other info */
85 #define SC_LOG_MAX_LOG_MSG_LEN 8192 + PATH_MAX + 512
86 
87 /* The maximum length of the log format */
88 #define SC_LOG_MAX_LOG_FORMAT_LEN 128
89 
90 /* The default log level, if it is not supplied by the user */
91 #define SC_LOG_DEF_LOG_LEVEL SC_LOG_INFO
92 
93 /* The default output interface to be used */
94 #define SC_LOG_DEF_LOG_OP_IFACE SC_LOG_OP_IFACE_CONSOLE
95 
96 /* The default log file to be used */
97 #define SC_LOG_DEF_LOG_FILE "suricata.log"
98 
99 /* The default syslog facility to be used */
100 #define SC_LOG_DEF_SYSLOG_FACILITY_STR "local0"
101 #define SC_LOG_DEF_SYSLOG_FACILITY LOG_LOCAL0
102 
103 /**
104  * \brief Structure to be used when log_level override support would be provided
105  * by the logging module
106  */
107 typedef struct SCLogOPBuffer_ {
109  char *temp;
110  const char *log_format;
112 
113 /**
114  * \brief The output interface context for the logging module
115  */
116 typedef struct SCLogOPIfaceCtx_ {
118 
119  bool use_color;
121 
122  /* the output file to be used if the interface is SC_LOG_IFACE_FILE */
123  const char *file;
124  /* the output file descriptor for the above file */
125  FILE * file_d;
126 
127  /* registered to be set on a file rotation signal */
129 
130  /* the facility code if the interface is SC_LOG_IFACE_SYSLOG */
131  int facility;
132 
133  /* override for the global_log_level */
135 
136  /* override for the global_log_format(currently not used) */
137  const char *log_format;
138 
139  /* Mutex used for locking around rotate/write to a file. */
141 
144 
145 /**
146  * \brief Structure containing init data, that would be passed to
147  * SCInitDebugModule()
148  */
149 typedef struct SCLogInitData_ {
150  /* startup message */
151  const char *startup_message;
152 
153  /* the log level */
155 
156  /* the log format */
157  const char *global_log_format;
158 
159  /* output filter */
160  const char *op_filter;
161 
162  /* list of output interfaces to be used */
164  /* no of op ifaces */
165  uint8_t op_ifaces_cnt;
167 
168 /**
169  * \brief Holds the config state used by the logging api
170  */
171 typedef struct SCLogConfig_ {
174  char *log_format;
175 
176  char *op_filter;
177  /* compiled pcre filter expression */
178  pcre2_code *op_filter_regex;
179  pcre2_match_data *op_filter_regex_match;
180 
181  /* op ifaces used */
183  /* no of op ifaces */
184  uint8_t op_ifaces_cnt;
186 
187 /* The different log format specifiers supported by the API */
188 #define SC_LOG_FMT_TIME 'z' /* Timestamp in RFC3339 like format */
189 #define SC_LOG_FMT_TIME_LEGACY 't' /* Timestamp in legacy format */
190 #define SC_LOG_FMT_PID 'p' /* PID */
191 #define SC_LOG_FMT_TID 'i' /* Thread ID */
192 #define SC_LOG_FMT_TM 'm' /* Thread module name */
193 #define SC_LOG_FMT_LOG_LEVEL 'd' /* Log level */
194 #define SC_LOG_FMT_LOG_SLEVEL 'D' /* Log level */
195 #define SC_LOG_FMT_FILE_NAME 'f' /* File name */
196 #define SC_LOG_FMT_LINE 'l' /* Line number */
197 #define SC_LOG_FMT_FUNCTION 'n' /* Function */
198 #define SC_LOG_FMT_SUBSYSTEM 'S' /* Subsystem name */
199 #define SC_LOG_FMT_THREAD_NAME 'T' /* thread name */
200 #define SC_LOG_FMT_MESSAGE 'M' /* log message body */
201 
202 /* The log format prefix for the format specifiers */
203 #define SC_LOG_FMT_PREFIX '%'
204 
205 /* Module and thread tagging */
206 /* The module name, usually the containing source-module name */
207 static const char *_sc_module __attribute__((unused)) = __SCFILENAME__;
208 
210 
211 extern int sc_log_module_initialized;
212 
213 extern int sc_log_module_cleaned;
214 
215 void SCLog(int x, const char *file, const char *func, const int line, const char *module,
216  const char *fmt, ...) ATTR_FMT_PRINTF(6, 7);
217 void SCLogErr(int x, const char *file, const char *func, const int line, const char *module,
218  const char *fmt, ...) ATTR_FMT_PRINTF(6, 7);
219 
220 /**
221  * \brief Macro used to log INFORMATIONAL messages.
222  *
223  * \retval ... Takes as argument(s), a printf style format message
224  */
225 #define SCLogInfo(...) SCLog(SC_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
226 #define SCLogInfoRaw(file, func, line, ...) \
227  SCLog(SC_LOG_INFO, (file), (func), (line), _sc_module, __VA_ARGS__)
228 
229 #define SCLogConfig(...) \
230  SCLog(SC_LOG_CONFIG, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
231 #define SCLogPerf(...) SCLog(SC_LOG_PERF, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
232 
233 /**
234  * \brief Macro used to log NOTICE messages.
235  *
236  * \retval ... Takes as argument(s), a printf style format message
237  */
238 #define SCLogNotice(...) \
239  SCLog(SC_LOG_NOTICE, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
240 #define SCLogNoticeRaw(file, func, line, ...) \
241  SCLog(SC_LOG_NOTICE, (file), (func), (line), _sc_module, __VA_ARGS__)
242 
243 /**
244  * \brief Macro used to log WARNING messages.
245  *
246  * \retval err_code Error code that has to be logged along with the
247  * warning message
248  * \retval ... Takes as argument(s), a printf style format message
249  */
250 #define SCLogWarning(...) \
251  SCLogErr(SC_LOG_WARNING, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
252 #define SCLogWarningRaw(file, func, line, ...) \
253  SCLogErr(SC_LOG_WARNING, (file), (func), (line), _sc_module, __VA_ARGS__)
254 
255 /**
256  * \brief Macro used to log ERROR messages.
257  *
258  * \retval err_code Error code that has to be logged along with the
259  * error message
260  * \retval ... Takes as argument(s), a printf style format message
261  */
262 #define SCLogError(...) \
263  SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
264 #define SCLogErrorRaw(file, func, line, ...) \
265  SCLogErr(SC_LOG_ERROR, (file), (func), (line), _sc_module, __VA_ARGS__)
266 
267 /* Avoid the overhead of using the debugging subsystem, in production mode */
268 #ifndef DEBUG
269 
270 #define SCLogDebug(...) do { } while (0)
271 
272 #define SCEnter(...)
273 
274 #define SCReturn return
275 
276 #define SCReturnInt(x) return x
277 
278 #define SCReturnUInt(x) return x
279 
280 #define SCReturnDbl(x) return x
281 
282 #define SCReturnChar(x) return x
283 
284 #define SCReturnCharPtr(x) return x
285 
286 #define SCReturnCT(x, type) return x
287 
288 #define SCReturnPtr(x, type) return x
289 
290 #define SCReturnBool(x) return x
291 
292 #define SCReturnStruct(x) return x
293 
294 /* Please use it only for debugging purposes */
295 #else
296 
297 
298 /**
299  * \brief Macro used to log DEBUG messages. Comes under the debugging subsystem,
300  * and hence will be enabled only in the presence of the DEBUG macro.
301  *
302  * \retval ... Takes as argument(s), a printf style format message
303  */
304 #define SCLogDebug(...) \
305  SCLog(SC_LOG_DEBUG, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
306 
307 /**
308  * \brief Macro used to log debug messages on function entry. Comes under the
309  * debugging subsystem, and hence will be enabled only in the presence
310  * of the DEBUG macro. Apart from logging function_entry logs, it also
311  * processes the FD filters, if any FD filters are registered.
312  *
313  * \retval f An argument can be supplied, although it is not used
314  */
315 #define SCEnter(f) do { \
316  if (sc_log_global_log_level >= SC_LOG_DEBUG &&\
317  SCLogCheckFDFilterEntry(__FUNCTION__)) \
318  { \
319  SCLogDebug("Entering ... >>"); \
320  } \
321  } while(0)
322 
323 /**
324  * \brief Macro used to log debug messages on function exit. Comes under the
325  * debugging subsystem, and hence will be enabled only in the presence
326  * of the DEBUG macro. Apart from logging function_exit logs, it also
327  * processes the FD filters, if any FD filters are registered. This
328  * function_exit macro should be used for functions that don't return
329  * a value.
330  */
331 #define SCReturn do { \
332  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
333  SCLogDebug("Returning ... <<" ); \
334  SCLogCheckFDFilterExit(__FUNCTION__); \
335  } \
336  return; \
337  } while(0)
338 
339 /**
340  * \brief Macro used to log debug messages on function exit. Comes under the
341  * debugging subsystem, and hence will be enabled only in the presence
342  * of the DEBUG macro. Apart from logging function_exit logs, it also
343  * processes the FD filters, if any FD filters are registered. This
344  * function_exit macro should be used for functions that returns an
345  * integer value.
346  *
347  * \retval x Variable of type 'integer' that has to be returned
348  */
349 #define SCReturnInt(x) do { \
350  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
351  SCLogDebug("Returning: %"PRIdMAX" ... <<", (intmax_t)x); \
352  SCLogCheckFDFilterExit(__FUNCTION__); \
353  } \
354  return x; \
355  } while(0)
356 
357 /**
358  * \brief Macro used to log debug messages on function exit. Comes under the
359  * debugging subsystem, and hence will be enabled only in the presence
360  * of the DEBUG macro. Apart from logging function_exit logs, it also
361  * processes the FD filters, if any FD filters are registered. This
362  * function_exit macro should be used for functions that returns an
363  * unsigned integer value.
364  *
365  * \retval x Variable of type 'unsigned integer' that has to be returned
366  */
367 #define SCReturnUInt(x) do { \
368  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
369  SCLogDebug("Returning: %"PRIuMAX" ... <<", (uintmax_t)x); \
370  SCLogCheckFDFilterExit(__FUNCTION__); \
371  } \
372  return x; \
373  } while(0)
374 
375 /**
376  * \brief Macro used to log debug messages on function exit. Comes under the
377  * debugging subsystem, and hence will be enabled only in the presence
378  * of the DEBUG macro. Apart from logging function_exit logs, it also
379  * processes the FD filters, if any FD filters are registered. This
380  * function_exit macro should be used for functions that returns a
381  * float/double value.
382  *
383  * \retval x Variable of type 'float/double' that has to be returned
384  */
385 #define SCReturnDbl(x) do { \
386  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
387  SCLogDebug("Returning: %f ... <<", x); \
388  SCLogCheckFDFilterExit(__FUNCTION__); \
389  } \
390  return x; \
391  } while(0)
392 
393 /**
394  * \brief Macro used to log debug messages on function exit. Comes under the
395  * debugging subsystem, and hence will be enabled only in the presence
396  * of the DEBUG macro. Apart from logging function_exit logs, it also
397  * processes the FD filters, if any FD filters are registered. This
398  * function_exit macro should be used for functions that returns a var
399  * of character type.
400  *
401  * \retval x Variable of type 'char' that has to be returned
402  */
403 #define SCReturnChar(x) do { \
404  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
405  SCLogDebug("Returning: %c ... <<", x); \
406  SCLogCheckFDFilterExit(__FUNCTION__); \
407  } \
408  return x; \
409  } while(0)
410 
411 /**
412  * \brief Macro used to log debug messages on function exit. Comes under the
413  * debugging subsystem, and hence will be enabled only in the presence
414  * of the DEBUG macro. Apart from logging function_exit logs, it also
415  * processes the FD filters, if any FD filters are registered. This
416  * function_exit macro should be used for functions that returns a
417  * character string.
418  *
419  * \retval x Pointer to the char string that has to be returned
420  */
421 #define SCReturnCharPtr(x) do { \
422  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
423  if ((x) != NULL) { \
424  SCLogDebug("Returning: %s ... <<", x); \
425  } else { \
426  SCLogDebug("Returning: NULL ... <<"); \
427  } SCLogCheckFDFilterExit(__FUNCTION__); \
428  } \
429  return x; \
430  } while(0)
431 
432 /**
433  * \brief Macro used to log debug messages on function exit. Comes under the
434  * debugging subsystem, and hence will be enabled only in the presence
435  * of the DEBUG macro. Apart from logging function_exit logs, it also
436  * processes the FD filters, if any FD filters are registered. This
437  * function_exit macro should be used for functions that returns a var
438  * of custom type
439  *
440  * \retval x Variable instance of a custom type that has to be returned
441  * \retval type Pointer to a character string holding the name of the custom
442  * type(the argument x) that has to be returned
443  */
444 #define SCReturnCT(x, type) do { \
445  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
446  SCLogDebug("Returning var of " \
447  "type %s ... <<", type); \
448  SCLogCheckFDFilterExit(__FUNCTION__); \
449  } \
450  return x; \
451  } while(0)
452 
453 /**
454  * \brief Macro used to log debug messages on function exit. Comes under the
455  * debugging subsystem, and hence will be enabled only in the presence
456  * of the DEBUG macro. Apart from logging function_exit logs, it also
457  * processes the FD filters, if any FD filters are registered. This
458  * function_exit macro should be used for functions that returns a
459  * pointer to a custom type
460  *
461  * \retval x Pointer to a variable instance of a custom type that has to be
462  * returned
463  * \retval type Pointer to a character string holding the name of the custom
464  * type(the argument x) that has to be returned
465  */
466 #define SCReturnPtr(x, type) do { \
467  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
468  SCLogDebug("Returning pointer %p of " \
469  "type %s ... <<", x, type); \
470  SCLogCheckFDFilterExit(__FUNCTION__); \
471  } \
472  return x; \
473  } while(0)
474 
475 /**
476  * \brief Macro used to log debug messages on function exit. Comes under the
477  * debugging subsystem, and hence will be enabled only in the presence
478  * of the DEBUG macro. Apart from logging function_exit logs, it also
479  * processes the FD filters, if any FD filters are registered. This
480  * function_exit macro should be used for functions that returns a
481  * boolean value.
482  *
483  * \retval x Variable of type 'bool' that has to be returned
484  */
485 #define SCReturnBool(x) do { \
486  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
487  SCLogDebug("Returning: %s ... <<", x ? "true" : "false"); \
488  SCLogCheckFDFilterExit(__FUNCTION__); \
489  } \
490  return x; \
491  } while(0)
492 
493 #define SCReturnStruct(x) do { \
494  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
495  SCLogDebug("Returning: ... <<"); \
496  SCLogCheckFDFilterExit(__FUNCTION__); \
497  } \
498  return x; \
499  } while(0)
500 
501 #endif /* DEBUG */
502 
503 #define FatalError(...) \
504  do { \
505  SCLogError(__VA_ARGS__); \
506  exit(EXIT_FAILURE); \
507  } while (0)
508 
509 /** \brief Fatal error IF we're starting up, and configured to consider
510  * errors to be fatal errors */
511 #if !defined(__clang_analyzer__)
512 #define FatalErrorOnInit(...) \
513  do { \
514  SC_ATOMIC_EXTERN(unsigned int, engine_stage); \
515  int init_errors_fatal = 0; \
516  (void)SCConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \
517  if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) { \
518  SCLogError(__VA_ARGS__); \
519  exit(EXIT_FAILURE); \
520  } \
521  SCLogWarning(__VA_ARGS__); \
522  } while (0)
523 /* make it simpler for scan-build */
524 #else
525 #define FatalErrorOnInit(...) FatalError(__VA_ARGS__)
526 #endif
527 
528 #define BOOL2STR(b) (b) ? "true" : "false"
529 
531 
533 
535 
536 void SCLogDeInitLogModule(void);
537 
538 SCError SCLogMessage(const SCLogLevel, const char *, const unsigned int, const char *, const char *,
539  const char *message);
540 
542 
543 int SCLogDebugEnabled(void);
544 
545 void SCLogRegisterTests(void);
546 
547 void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid);
548 #endif // #ifndef SURICATA_BINDGEN_H
549 
550 void SCFatalErrorOnInitStatic(const char *);
551 
553 
554 #endif /* SURICATA_UTIL_DEBUG_H */
SCLogConfig_::op_ifaces
SCLogOPIfaceCtx * op_ifaces
Definition: util-debug.h:182
SCLogConfig_::op_filter_regex_match
pcre2_match_data * op_filter_regex_match
Definition: util-debug.h:179
SCLogAllocLogOPBuffer
SCLogOPBuffer * SCLogAllocLogOPBuffer(void)
Allocates an output buffer for an output interface. Used when we want the op_interface log_format to ...
Definition: util-debug.c:786
__SCFILENAME__
#define __SCFILENAME__
Definition: suricata-common.h:64
SCLogMessage
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.
Definition: util-debug.c:652
SCLogOPIfaceCtx_::log_level
SCLogLevel log_level
Definition: util-debug.h:134
SCLogOPIfaceCtx_::facility
int facility
Definition: util-debug.h:131
SC_LOG_DEBUG
@ SC_LOG_DEBUG
Definition: util-debug.h:41
SC_LOG_OP_TYPE_REGULAR
@ SC_LOG_OP_TYPE_REGULAR
Definition: util-debug.h:73
SC_LOG_CONFIG
@ SC_LOG_CONFIG
Definition: util-debug.h:40
SC_LOG_NOTSET
@ SC_LOG_NOTSET
Definition: util-debug.h:33
SCLogLoadConfig
void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
Definition: util-debug.c:1420
SCLogInitData_::global_log_format
const char * global_log_format
Definition: util-debug.h:157
SC_LOG_OP_TYPE_JSON
@ SC_LOG_OP_TYPE_JSON
Definition: util-debug.h:74
SCLogAppendOPIfaceCtx
void SCLogAppendOPIfaceCtx(SCLogOPIfaceCtx *, SCLogInitData *)
Appends an output_interface to the output_interface list sent in head.
Definition: util-debug.c:1306
SCLogErr
void void SCLogErr(int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) ATTR_FMT_PRINTF(6
sc_log_module_cleaned
int sc_log_module_cleaned
Used to indicate whether the logging module has been cleaned or not.
Definition: util-debug.c:111
SCLogOPBuffer_
Structure to be used when log_level override support would be provided by the logging module.
Definition: util-debug.h:107
SCLogOPIfaceCtx_::fp_mutex
SCMutex fp_mutex
Definition: util-debug.h:140
threads.h
SCLogOPIfaceCtx_::use_color
bool use_color
Definition: util-debug.h:119
SCLogConfig_::op_filter
char * op_filter
Definition: util-debug.h:176
SCLogAllocLogInitData
SCLogInitData * SCLogAllocLogInitData(void)
Returns a pointer to a new SCLogInitData. This is a public interface intended to be used after the lo...
Definition: util-debug.c:1250
SC_LOG_NOTICE
@ SC_LOG_NOTICE
Definition: util-debug.h:37
SCLogOPIfaceCtx_::log_format
const char * log_format
Definition: util-debug.h:137
SCLogInitData_
Structure containing init data, that would be passed to SCInitDebugModule()
Definition: util-debug.h:149
SCLogInitLogModule
void SCLogInitLogModule(SCLogInitData *)
Initializes the logging module.
Definition: util-debug.c:1390
SCLogOPType
SCLogOPType
Definition: util-debug.h:72
SCLogOPIfaceCtx_::type
SCLogOPType type
Definition: util-debug.h:120
SC_LOG_LEVEL_MAX
@ SC_LOG_LEVEL_MAX
Definition: util-debug.h:42
SCLogDeInitLogModule
void SCLogDeInitLogModule(void)
De-Initializes the logging module.
Definition: util-debug.c:1594
SCLogOPIfaceCtx_
The output interface context for the logging module.
Definition: util-debug.h:116
__attribute__
enum @12 __attribute__
DNP3 application header.
ATTR_FMT_PRINTF
#define ATTR_FMT_PRINTF(x, y)
Definition: suricata-common.h:427
SC_LOG_INFO
@ SC_LOG_INFO
Definition: util-debug.h:38
SCLogDebugEnabled
int SCLogDebugEnabled(void)
Returns whether debug messages are enabled to be logged or not.
Definition: util-debug.c:767
SC_LOG_ERROR
@ SC_LOG_ERROR
Definition: util-debug.h:35
util-error.h
SCFatalErrorOnInitStatic
void SCFatalErrorOnInitStatic(const char *)
Definition: util-debug.c:1614
SCLogConfig_::op_filter_regex
pcre2_code * op_filter_regex
Definition: util-debug.h:178
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: util-debug.c:101
SCLog
void SCLog(int x, const char *file, const char *func, const int line, const char *module, const char *fmt,...) ATTR_FMT_PRINTF(6
SCLogOPIface
SCLogOPIface
The various output interfaces supported.
Definition: util-debug.h:65
SCLogOPIfaceCtx
struct SCLogOPIfaceCtx_ SCLogOPIfaceCtx
The output interface context for the logging module.
SCLogConfig_::op_ifaces_cnt
uint8_t op_ifaces_cnt
Definition: util-debug.h:184
SCLogConfig_::log_level
SCLogLevel log_level
Definition: util-debug.h:173
SC_LOG_OP_IFACE_MAX
@ SC_LOG_OP_IFACE_MAX
Definition: util-debug.h:69
SCLogOPIfaceCtx_::iface
SCLogOPIface iface
Definition: util-debug.h:117
SCLogOPBuffer_::log_format
const char * log_format
Definition: util-debug.h:110
SCLogOPIfaceCtx_::file
const char * file
Definition: util-debug.h:123
SCLogOPBuffer
struct SCLogOPBuffer_ SCLogOPBuffer
Structure to be used when log_level override support would be provided by the logging module.
SCLogConfig_::startup_message
char * startup_message
Definition: util-debug.h:172
SCLogOPBuffer_::msg
char msg[SC_LOG_MAX_LOG_MSG_LEN]
Definition: util-debug.h:108
SCLogInitData_::global_log_level
SCLogLevel global_log_level
Definition: util-debug.h:154
SC_LOG_OP_IFACE_FILE
@ SC_LOG_OP_IFACE_FILE
Definition: util-debug.h:67
SCLogLevel
SCLogLevel
The various log levels NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLe...
Definition: util-debug.h:32
SCLogGetLogLevel
SCLogLevel SCLogGetLogLevel(void)
Definition: util-debug.c:1070
SC_LOG_WARNING
@ SC_LOG_WARNING
Definition: util-debug.h:36
SCLogInitData_::op_filter
const char * op_filter
Definition: util-debug.h:160
suricata-common.h
SCLogConfig_::log_format
char * log_format
Definition: util-debug.h:174
SCLogOPIfaceCtx_::next
struct SCLogOPIfaceCtx_ * next
Definition: util-debug.h:142
SCError
SCError
Definition: util-error.h:26
SC_LOG_PERF
@ SC_LOG_PERF
Definition: util-debug.h:39
SCLogConfig_
Holds the config state used by the logging api.
Definition: util-debug.h:171
SCLogInitData_::op_ifaces_cnt
uint8_t op_ifaces_cnt
Definition: util-debug.h:165
SCLogOPIfaceCtx_::rotation_flag
int rotation_flag
Definition: util-debug.h:128
SC_LOG_OP_IFACE_SYSLOG
@ SC_LOG_OP_IFACE_SYSLOG
Definition: util-debug.h:68
SC_LOG_MAX_LOG_MSG_LEN
#define SC_LOG_MAX_LOG_MSG_LEN
Definition: util-debug.h:85
SCLogRegisterTests
void SCLogRegisterTests(void)
Definition: util-debug.c:1801
SCLogOPBuffer_::temp
char * temp
Definition: util-debug.h:109
SC_LOG_NONE
@ SC_LOG_NONE
Definition: util-debug.h:34
SCLogConfig
#define SCLogConfig(...)
Definition: util-debug.h:229
SCLogOPIfaceCtx_::file_d
FILE * file_d
Definition: util-debug.h:125
util-debug-filters.h
SCLogInitData_::startup_message
const char * startup_message
Definition: util-debug.h:151
SCLogInitData_::op_ifaces
SCLogOPIfaceCtx * op_ifaces
Definition: util-debug.h:163
SCLogInitData
struct SCLogInitData_ SCLogInitData
Structure containing init data, that would be passed to SCInitDebugModule()
SC_LOG_OP_IFACE_CONSOLE
@ SC_LOG_OP_IFACE_CONSOLE
Definition: util-debug.h:66
SCMutex
#define SCMutex
Definition: threads-debug.h:114
sc_log_module_initialized
int sc_log_module_initialized
Used to indicate whether the logging module has been init or not.
Definition: util-debug.c:106