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