suricata
output.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2024 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 OISF, Jason Ish <jason.ish@oisf.net>
22  * \author Endace Technology Limited, Jason Ish <jason.ish@endace.com>
23  *
24  * The root logging output for all non-application logging.
25  *
26  * The loggers are made up of a hierarchy of loggers. At the top we
27  * have the root logger which is the main entry point to
28  * logging. Under the root there exists parent loggers that are the
29  * entry point for specific types of loggers such as packet logger,
30  * transaction loggers, etc. Each parent logger may have 0 or more
31  * loggers that actual handle the job of producing output to something
32  * like a file.
33  */
34 
35 #include "suricata-common.h"
36 #include "flow.h"
37 #include "conf.h"
38 #include "tm-threads.h"
39 #include "util-error.h"
40 #include "util-debug.h"
41 #include "output.h"
42 #include "output-eve.h"
43 
44 #include "alert-fastlog.h"
45 #include "alert-debuglog.h"
46 #include "alert-syslog.h"
47 #include "output-json.h"
48 #include "output-json-alert.h"
49 #include "output-json-anomaly.h"
50 #include "output-json-flow.h"
51 #include "output-json-netflow.h"
52 #include "log-cf-common.h"
53 #include "output-json-drop.h"
54 #include "output-eve-stream.h"
55 #include "log-httplog.h"
56 #include "output-json-http.h"
57 #include "output-json-dns.h"
58 #include "output-json-mdns.h"
59 #include "log-tlsstore.h"
60 #include "output-json-tls.h"
61 #include "log-pcap.h"
62 // for SSHTxLogCondition
63 #include "app-layer-ssh.h"
64 #include "output-json-file.h"
65 #include "output-json-smtp.h"
66 #include "output-json-stats.h"
67 #include "log-tcp-data.h"
68 #include "log-stats.h"
69 #include "output-json-nfs.h"
70 #include "output-json-ftp.h"
71 // for misplaced EveFTPDataAddMetadata
72 #include "app-layer-ftp.h"
73 #include "output-json-smb.h"
74 #include "output-json-ike.h"
75 #include "output-json-dhcp.h"
76 #include "output-json-mqtt.h"
77 #include "output-json-pgsql.h"
78 #include "output-lua.h"
79 #include "output-json-dnp3.h"
80 #include "output-json-metadata.h"
81 #include "output-json-dcerpc.h"
82 #include "output-json-frame.h"
83 #include "app-layer-parser.h"
84 #include "output-filestore.h"
85 #include "output-json-arp.h"
86 
87 typedef struct RootLogger_ {
92 
93  TAILQ_ENTRY(RootLogger_) entries;
95 
96 /* List of registered root loggers. These are registered at start up and
97  * are independent of configuration. Later we will build a list of active
98  * loggers based on configuration. */
99 static TAILQ_HEAD(, RootLogger_) registered_loggers =
100  TAILQ_HEAD_INITIALIZER(registered_loggers);
101 
102 /* List of active root loggers. This means that at least one logger is enabled
103  * for each root logger type in the config. */
104 static TAILQ_HEAD(, RootLogger_) active_loggers =
105  TAILQ_HEAD_INITIALIZER(active_loggers);
106 
107 typedef struct LoggerThreadStoreNode_ {
108  void *thread_data;
109  TAILQ_ENTRY(LoggerThreadStoreNode_) entries;
111 
112 typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_) LoggerThreadStore;
113 
114 /**
115  * The list of all registered (known) output modules.
116  */
118 
119 /**
120  * Registry of flags to be updated on file rotation notification.
121  */
122 typedef struct OutputFileRolloverFlag_ {
123  int *flag;
124 
125  TAILQ_ENTRY(OutputFileRolloverFlag_) entries;
127 
128 static SCMutex output_file_rotation_mutex = SCMUTEX_INITIALIZER;
129 
130 TAILQ_HEAD(, OutputFileRolloverFlag_) output_file_rotation_flags =
131  TAILQ_HEAD_INITIALIZER(output_file_rotation_flags);
132 
133 /**
134  * Callback function to be called when logging is ready.
135  */
136 typedef void (*SCOnLoggingReadyCallback)(void *arg);
137 
138 /**
139  * List entries for callbacks registered to be called when the logging system is
140  * ready. This is useful for both plugins and library users who need to register
141  * application transaction loggers after logging initialization is complete.
142  */
143 typedef struct OnLoggingReadyCallbackNode_ {
144  SCOnLoggingReadyCallback callback;
145  void *arg;
146  TAILQ_ENTRY(OnLoggingReadyCallbackNode_) entries;
148 
149 /**
150  * The list of callbacks to be called when logging is ready.
151  */
152 static TAILQ_HEAD(, OnLoggingReadyCallbackNode_)
153  on_logging_ready_callbacks = TAILQ_HEAD_INITIALIZER(on_logging_ready_callbacks);
154 
155 void OutputRegisterRootLoggers(void);
156 void OutputRegisterLoggers(void);
157 
158 /**
159  * \brief Register an output module.
160  *
161  * This function will register an output module so it can be
162  * configured with the configuration file.
163  *
164  * \retval Returns 0 on success, -1 on failure.
165  */
166 void OutputRegisterModule(const char *name, const char *conf_name,
167  OutputInitFunc InitFunc)
168 {
169  OutputModule *module = SCCalloc(1, sizeof(*module));
170  if (unlikely(module == NULL))
171  goto error;
172 
173  module->name = name;
174  module->conf_name = conf_name;
175  module->InitFunc = InitFunc;
176  TAILQ_INSERT_TAIL(&output_modules, module, entries);
177 
178  SCLogDebug("Output module \"%s\" registered.", name);
179 
180  return;
181 
182 error:
183  FatalError("Fatal error encountered in OutputRegisterModule. Exiting...");
184 }
185 
186 /**
187  * \brief Register a packet output module.
188  *
189  * This function will register an output module so it can be
190  * configured with the configuration file.
191  *
192  * \retval Returns 0 on success, -1 on failure.
193  */
194 void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name,
195  OutputInitFunc InitFunc, OutputPacketLoggerFunctions *output_module_functions)
196 {
197  if (unlikely(output_module_functions->LogFunc == NULL ||
198  output_module_functions->ConditionFunc == NULL)) {
199  goto error;
200  }
201 
202  OutputModule *module = SCCalloc(1, sizeof(*module));
203  if (unlikely(module == NULL)) {
204  goto error;
205  }
206 
207  module->logger_id = id;
208  module->name = name;
209  module->conf_name = conf_name;
210  module->InitFunc = InitFunc;
211  module->PacketLogFunc = output_module_functions->LogFunc;
212  module->PacketConditionFunc = output_module_functions->ConditionFunc;
213  module->ThreadInit = output_module_functions->ThreadInitFunc;
214  module->ThreadDeinit = output_module_functions->ThreadDeinitFunc;
215  TAILQ_INSERT_TAIL(&output_modules, module, entries);
216 
217  SCLogDebug("Packet logger \"%s\" registered.", name);
218  return;
219 error:
220  FatalError("Fatal error encountered. Exiting...");
221 }
222 
223 /**
224  * \brief Register a packet output sub-module.
225  *
226  * This function will register an output module so it can be
227  * configured with the configuration file.
228  *
229  * \retval Returns 0 on success, -1 on failure.
230  */
231 void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name,
232  const char *conf_name, OutputInitSubFunc InitFunc,
233  OutputPacketLoggerFunctions *output_logger_functions)
234 {
235  if (unlikely(output_logger_functions->LogFunc == NULL ||
236  output_logger_functions->ConditionFunc == NULL)) {
237  goto error;
238  }
239 
240  OutputModule *module = SCCalloc(1, sizeof(*module));
241  if (unlikely(module == NULL)) {
242  goto error;
243  }
244 
245  module->logger_id = id;
246  module->name = name;
247  module->conf_name = conf_name;
248  module->parent_name = parent_name;
249  module->InitSubFunc = InitFunc;
250  module->PacketLogFunc = output_logger_functions->LogFunc;
251  module->PacketConditionFunc = output_logger_functions->ConditionFunc;
252  module->ThreadInit = output_logger_functions->ThreadInitFunc;
253  module->ThreadDeinit = output_logger_functions->ThreadDeinitFunc;
254  TAILQ_INSERT_TAIL(&output_modules, module, entries);
255 
256  SCLogDebug("Packet logger \"%s\" registered.", name);
257  return;
258 error:
259  FatalError("Fatal error encountered. Exiting...");
260 }
261 
262 /**
263  * \brief Wrapper function for tx output modules.
264  *
265  * This function will register an output module so it can be
266  * configured with the configuration file.
267  *
268  * \retval Returns 0 on success, -1 on failure.
269  */
270 static void OutputRegisterTxModuleWrapper(LoggerId id, const char *name, const char *conf_name,
271  OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress,
272  int ts_log_progress, TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit,
273  ThreadDeinitFunc ThreadDeinit)
274 {
275  if (unlikely(TxLogFunc == NULL)) {
276  goto error;
277  }
278 
279  OutputModule *module = SCCalloc(1, sizeof(*module));
280  if (unlikely(module == NULL)) {
281  goto error;
282  }
283 
284  module->logger_id = id;
285  module->name = name;
286  module->conf_name = conf_name;
287  module->InitFunc = InitFunc;
288  module->TxLogFunc = TxLogFunc;
289  module->TxLogCondition = TxLogCondition;
290  module->alproto = alproto;
291  module->tc_log_progress = tc_log_progress;
292  module->ts_log_progress = ts_log_progress;
293  module->ThreadInit = ThreadInit;
294  module->ThreadDeinit = ThreadDeinit;
295  TAILQ_INSERT_TAIL(&output_modules, module, entries);
296 
297  SCLogDebug("Tx logger \"%s\" registered.", name);
298  return;
299 error:
300  FatalError("Fatal error encountered. Exiting...");
301 }
302 
303 static void OutputRegisterTxSubModuleWrapper(LoggerId id, const char *parent_name, const char *name,
304  const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
305  int tc_log_progress, int ts_log_progress, TxLoggerCondition TxLogCondition,
306  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
307 {
308  if (unlikely(TxLogFunc == NULL)) {
309  goto error;
310  }
311 
312  OutputModule *module = SCCalloc(1, sizeof(*module));
313  if (unlikely(module == NULL)) {
314  goto error;
315  }
316 
317  module->logger_id = id;
318  module->name = name;
319  module->conf_name = conf_name;
320  module->parent_name = parent_name;
321  module->InitSubFunc = InitFunc;
322  module->TxLogFunc = TxLogFunc;
323  module->TxLogCondition = TxLogCondition;
324  module->alproto = alproto;
325  module->tc_log_progress = tc_log_progress;
326  module->ts_log_progress = ts_log_progress;
327  module->ThreadInit = ThreadInit;
328  module->ThreadDeinit = ThreadDeinit;
329  TAILQ_INSERT_TAIL(&output_modules, module, entries);
330 
331  SCLogDebug("Tx logger for alproto %d \"%s\" registered.", alproto, name);
332  return;
333 error:
334  FatalError("Fatal error encountered. Exiting...");
335 }
336 
337 /**
338  * \brief Register a tx output module with condition.
339  *
340  * This function will register an output module so it can be
341  * configured with the configuration file.
342  *
343  * \retval Returns 0 on success, -1 on failure.
344  */
345 void OutputRegisterTxModuleWithCondition(LoggerId id, const char *name, const char *conf_name,
346  OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
347  TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
348 {
349  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto, TxLogFunc, -1, -1,
350  TxLogCondition, ThreadInit, ThreadDeinit);
351 }
352 
353 void OutputRegisterTxSubModuleWithCondition(LoggerId id, const char *parent_name, const char *name,
354  const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
355  TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
356 {
357  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name, InitFunc, alproto, TxLogFunc,
358  -1, -1, TxLogCondition, ThreadInit, ThreadDeinit);
359 }
360 
361 /**
362  * \brief Register a tx output module with progress.
363  *
364  * This function will register an output module so it can be
365  * configured with the configuration file.
366  *
367  * \retval Returns 0 on success, -1 on failure.
368  */
369 void OutputRegisterTxModuleWithProgress(LoggerId id, const char *name, const char *conf_name,
370  OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress,
371  int ts_log_progress, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
372 {
373  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto, TxLogFunc,
374  tc_log_progress, ts_log_progress, NULL, ThreadInit, ThreadDeinit);
375 }
376 
377 void OutputRegisterTxSubModuleWithProgress(LoggerId id, const char *parent_name, const char *name,
378  const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
379  int tc_log_progress, int ts_log_progress, ThreadInitFunc ThreadInit,
380  ThreadDeinitFunc ThreadDeinit)
381 {
382  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name, InitFunc, alproto, TxLogFunc,
383  tc_log_progress, ts_log_progress, NULL, ThreadInit, ThreadDeinit);
384 }
385 
386 /**
387  * \brief Register a tx output module.
388  *
389  * This function will register an output module so it can be
390  * configured with the configuration file.
391  *
392  * \retval Returns 0 on success, -1 on failure.
393  */
394 void OutputRegisterTxModule(LoggerId id, const char *name, const char *conf_name,
395  OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit,
396  ThreadDeinitFunc ThreadDeinit)
397 {
398  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto, TxLogFunc, -1, -1, NULL,
399  ThreadInit, ThreadDeinit);
400 }
401 
402 void OutputRegisterTxSubModule(LoggerId id, const char *parent_name, const char *name,
403  const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
404  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
405 {
406  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name, InitFunc, alproto, TxLogFunc,
407  -1, -1, NULL, ThreadInit, ThreadDeinit);
408 }
409 
410 /**
411  * \brief Register a file output sub-module.
412  *
413  * This function will register an output module so it can be
414  * configured with the configuration file.
415  *
416  * \retval Returns 0 on success, -1 on failure.
417  */
418 void OutputRegisterFileSubModule(LoggerId id, const char *parent_name, const char *name,
419  const char *conf_name, OutputInitSubFunc InitFunc, SCFileLogger FileLogFunc,
420  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
421 {
422  if (unlikely(FileLogFunc == NULL)) {
423  goto error;
424  }
425 
426  OutputModule *module = SCCalloc(1, sizeof(*module));
427  if (unlikely(module == NULL)) {
428  goto error;
429  }
430 
431  module->logger_id = id;
432  module->name = name;
433  module->conf_name = conf_name;
434  module->parent_name = parent_name;
435  module->InitSubFunc = InitFunc;
436  module->FileLogFunc = FileLogFunc;
437  module->ThreadInit = ThreadInit;
438  module->ThreadDeinit = ThreadDeinit;
439  TAILQ_INSERT_TAIL(&output_modules, module, entries);
440 
441  SCLogDebug("File logger \"%s\" registered.", name);
442  return;
443 error:
444  FatalError("Fatal error encountered. Exiting...");
445 }
446 
447 /**
448  * \brief Register a file data output module.
449  *
450  * This function will register an output module so it can be
451  * configured with the configuration file.
452  *
453  * \retval Returns 0 on success, -1 on failure.
454  */
455 void OutputRegisterFiledataModule(LoggerId id, const char *name, const char *conf_name,
456  OutputInitFunc InitFunc, SCFiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit,
457  ThreadDeinitFunc ThreadDeinit)
458 {
459  if (unlikely(FiledataLogFunc == NULL)) {
460  goto error;
461  }
462 
463  OutputModule *module = SCCalloc(1, sizeof(*module));
464  if (unlikely(module == NULL)) {
465  goto error;
466  }
467 
468  module->logger_id = id;
469  module->name = name;
470  module->conf_name = conf_name;
471  module->InitFunc = InitFunc;
472  module->FiledataLogFunc = FiledataLogFunc;
473  module->ThreadInit = ThreadInit;
474  module->ThreadDeinit = ThreadDeinit;
475  TAILQ_INSERT_TAIL(&output_modules, module, entries);
476 
477  SCLogDebug("Filedata logger \"%s\" registered.", name);
478  return;
479 error:
480  FatalError("Fatal error encountered. Exiting...");
481 }
482 
483 /**
484  * \brief Register a flow output sub-module.
485  *
486  * This function will register an output module so it can be
487  * configured with the configuration file.
488  *
489  * \retval Returns 0 on success, -1 on failure.
490  */
491 void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name,
492  const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc,
493  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
494 {
495  if (unlikely(FlowLogFunc == NULL)) {
496  goto error;
497  }
498 
499  OutputModule *module = SCCalloc(1, sizeof(*module));
500  if (unlikely(module == NULL)) {
501  goto error;
502  }
503 
504  module->logger_id = id;
505  module->name = name;
506  module->conf_name = conf_name;
507  module->parent_name = parent_name;
508  module->InitSubFunc = InitFunc;
509  module->FlowLogFunc = FlowLogFunc;
510  module->ThreadInit = ThreadInit;
511  module->ThreadDeinit = ThreadDeinit;
512  TAILQ_INSERT_TAIL(&output_modules, module, entries);
513 
514  SCLogDebug("Flow logger \"%s\" registered.", name);
515  return;
516 error:
517  FatalError("Fatal error encountered. Exiting...");
518 }
519 
520 /**
521  * \brief Register a streaming data output module.
522  *
523  * This function will register an output module so it can be
524  * configured with the configuration file.
525  *
526  * \retval Returns 0 on success, -1 on failure.
527  */
528 void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *conf_name,
529  OutputInitFunc InitFunc, SCStreamingLogger StreamingLogFunc,
530  enum SCOutputStreamingType stream_type, ThreadInitFunc ThreadInit,
531  ThreadDeinitFunc ThreadDeinit)
532 {
533  if (unlikely(StreamingLogFunc == NULL)) {
534  goto error;
535  }
536 
537  OutputModule *module = SCCalloc(1, sizeof(*module));
538  if (unlikely(module == NULL)) {
539  goto error;
540  }
541 
542  module->logger_id = id;
543  module->name = name;
544  module->conf_name = conf_name;
545  module->InitFunc = InitFunc;
546  module->StreamingLogFunc = StreamingLogFunc;
547  module->stream_type = stream_type;
548  module->ThreadInit = ThreadInit;
549  module->ThreadDeinit = ThreadDeinit;
550  TAILQ_INSERT_TAIL(&output_modules, module, entries);
551 
552  SCLogDebug("Streaming logger \"%s\" registered.", name);
553  return;
554 error:
555  FatalError("Fatal error encountered. Exiting...");
556 }
557 
558 /**
559  * \brief Register a stats data output module.
560  *
561  * This function will register an output module so it can be
562  * configured with the configuration file.
563  *
564  * \retval Returns 0 on success, -1 on failure.
565  */
566 void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name,
567  OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
568  ThreadDeinitFunc ThreadDeinit)
569 {
570  if (unlikely(StatsLogFunc == NULL)) {
571  goto error;
572  }
573 
574  OutputModule *module = SCCalloc(1, sizeof(*module));
575  if (unlikely(module == NULL)) {
576  goto error;
577  }
578 
579  module->logger_id = id;
580  module->name = name;
581  module->conf_name = conf_name;
582  module->InitFunc = InitFunc;
583  module->StatsLogFunc = StatsLogFunc;
584  module->ThreadInit = ThreadInit;
585  module->ThreadDeinit = ThreadDeinit;
586  TAILQ_INSERT_TAIL(&output_modules, module, entries);
587 
588  SCLogDebug("Stats logger \"%s\" registered.", name);
589  return;
590 error:
591  FatalError("Fatal error encountered. Exiting...");
592 }
593 
594 /**
595  * \brief Register a stats data output sub-module.
596  *
597  * This function will register an output module so it can be
598  * configured with the configuration file.
599  *
600  * \retval Returns 0 on success, -1 on failure.
601  */
602 void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name,
603  const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc,
604  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
605 {
606  if (unlikely(StatsLogFunc == NULL)) {
607  goto error;
608  }
609 
610  OutputModule *module = SCCalloc(1, sizeof(*module));
611  if (unlikely(module == NULL)) {
612  goto error;
613  }
614 
615  module->logger_id = id;
616  module->name = name;
617  module->conf_name = conf_name;
618  module->parent_name = parent_name;
619  module->InitSubFunc = InitFunc;
620  module->StatsLogFunc = StatsLogFunc;
621  module->ThreadInit = ThreadInit;
622  module->ThreadDeinit = ThreadDeinit;
623  TAILQ_INSERT_TAIL(&output_modules, module, entries);
624 
625  SCLogDebug("Stats logger \"%s\" registered.", name);
626  return;
627 error:
628  FatalError("Fatal error encountered. Exiting...");
629 }
630 
631 /**
632  * \brief Get an output module by name.
633  *
634  * \retval The OutputModule with the given name or NULL if no output module
635  * with the given name is registered.
636  */
638 {
639  OutputModule *module;
640 
641  TAILQ_FOREACH(module, &output_modules, entries) {
642  if (strcmp(module->conf_name, conf_name) == 0)
643  return module;
644  }
645 
646  return NULL;
647 }
648 
649 static EveJsonSimpleAppLayerLogger *simple_json_applayer_loggers;
650 
651 /**
652  * \brief Deregister all modules. Useful for a memory clean exit.
653  */
655 {
656  OutputModule *module;
657 
658  while ((module = TAILQ_FIRST(&output_modules))) {
659  TAILQ_REMOVE(&output_modules, module, entries);
660  SCFree(module);
661  }
662  SCFree(simple_json_applayer_loggers);
663  simple_json_applayer_loggers = NULL;
664 }
665 
666 static int drop_loggers = 0;
667 
669 {
670  if (drop_loggers)
671  return -1;
672  drop_loggers++;
673  return 0;
674 }
675 
677 {
678  if (drop_loggers)
679  drop_loggers--;
680 }
681 
682 /**
683  * \brief Register a flag for file rotation notification.
684  *
685  * \param flag A pointer that will be set to 1 when file rotation is
686  * requested.
687  */
689 {
690  OutputFileRolloverFlag *flag_entry = SCCalloc(1, sizeof(*flag_entry));
691  if (unlikely(flag_entry == NULL)) {
692  SCLogError("Failed to allocate memory to register file rotation flag");
693  return;
694  }
695  flag_entry->flag = flag;
696  SCMutexLock(&output_file_rotation_mutex);
697  TAILQ_INSERT_TAIL(&output_file_rotation_flags, flag_entry, entries);
698  SCMutexUnlock(&output_file_rotation_mutex);
699 }
700 
701 /**
702  * \brief Unregister a file rotation flag.
703  *
704  * Note that it is safe to call this function with a flag that may not
705  * have been registered, in which case this function won't do
706  * anything.
707  *
708  * \param flag A pointer that has been previously registered for file
709  * rotation notifications.
710  */
712 {
713  OutputFileRolloverFlag *entry, *next;
714  SCMutexLock(&output_file_rotation_mutex);
715  for (entry = TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;
716  entry = next) {
717  next = TAILQ_NEXT(entry, entries);
718  if (entry->flag == flag) {
719  TAILQ_REMOVE(&output_file_rotation_flags, entry, entries);
720  SCMutexUnlock(&output_file_rotation_mutex);
721  SCFree(entry);
722  return;
723  }
724  }
725  SCMutexUnlock(&output_file_rotation_mutex);
726 }
727 
728 /**
729  * \brief Notifies all registered file rotation notification flags.
730  */
732  OutputFileRolloverFlag *flag = NULL;
733  OutputFileRolloverFlag *tflag;
734  SCMutexLock(&output_file_rotation_mutex);
735  TAILQ_FOREACH_SAFE (flag, &output_file_rotation_flags, entries, tflag) {
736  *(flag->flag) = 1;
737  }
738  SCMutexUnlock(&output_file_rotation_mutex);
739 }
740 
741 /**
742  * \brief Register a callback to be called when logging is ready.
743  *
744  * This function registers a callback that will be invoked when the logging
745  * system has been fully initialized. This is useful for both plugins and
746  * library users who need to register application transaction loggers after
747  * logging initialization is complete.
748  *
749  * \param callback The callback function to be called
750  * \param arg An argument to be passed to the callback function
751  * \return 0 on success, -1 on failure
752  */
754 {
755  OnLoggingReadyCallbackNode *node = SCCalloc(1, sizeof(*node));
756  if (node == NULL) {
757  SCLogError("Failed to allocate memory for callback node");
758  return -1;
759  }
760 
761  node->callback = callback;
762  node->arg = arg;
763  TAILQ_INSERT_TAIL(&on_logging_ready_callbacks, node, entries);
764 
765  return 0;
766 }
767 
768 /**
769  * \brief Invokes all registered logging ready callbacks.
770  *
771  * This function should be called after the logging system has been fully
772  * initialized to notify all registered callbacks that logging is ready.
773  */
775 {
776  OnLoggingReadyCallbackNode *node = NULL;
777  TAILQ_FOREACH (node, &on_logging_ready_callbacks, entries) {
778  if (node->callback) {
779  (*node->callback)(node->arg);
780  }
781  }
782 }
783 
784 TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
785 {
786  LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
787  RootLogger *logger = TAILQ_FIRST(&active_loggers);
788  LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);
789  while (logger && thread_store_node) {
790  logger->LogFunc(tv, p, thread_store_node->thread_data);
791 
792  logger = TAILQ_NEXT(logger, entries);
793  thread_store_node = TAILQ_NEXT(thread_store_node, entries);
794  }
795  return TM_ECODE_OK;
796 }
797 
798 TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
799 {
800  LoggerThreadStore *thread_store = SCCalloc(1, sizeof(*thread_store));
801  if (thread_store == NULL) {
802  return TM_ECODE_FAILED;
803  }
804  TAILQ_INIT(thread_store);
805  *data = (void *)thread_store;
806 
807  RootLogger *logger;
808  TAILQ_FOREACH(logger, &active_loggers, entries) {
809 
810  void *child_thread_data = NULL;
811  if (logger->ThreadInit != NULL) {
812  if (logger->ThreadInit(tv, initdata, &child_thread_data) == TM_ECODE_OK) {
813  LoggerThreadStoreNode *thread_store_node =
814  SCCalloc(1, sizeof(*thread_store_node));
815  if (thread_store_node == NULL) {
816  /* Undo everything, calling de-init will take care
817  * of that. */
818  OutputLoggerThreadDeinit(tv, thread_store);
819  return TM_ECODE_FAILED;
820  }
821  thread_store_node->thread_data = child_thread_data;
822  TAILQ_INSERT_TAIL(thread_store, thread_store_node, entries);
823  }
824  }
825  }
826  return TM_ECODE_OK;
827 }
828 
830 {
831  if (thread_data == NULL)
832  return TM_ECODE_FAILED;
833 
834  LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
835  RootLogger *logger = TAILQ_FIRST(&active_loggers);
836  LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);
837  while (logger && thread_store_node) {
838  if (logger->ThreadDeinit != NULL) {
839  logger->ThreadDeinit(tv, thread_store_node->thread_data);
840  }
841  logger = TAILQ_NEXT(logger, entries);
842  thread_store_node = TAILQ_NEXT(thread_store_node, entries);
843  }
844 
845  /* Free the thread store. */
846  while ((thread_store_node = TAILQ_FIRST(thread_store)) != NULL) {
847  TAILQ_REMOVE(thread_store, thread_store_node, entries);
848  SCFree(thread_store_node);
849  }
850  SCFree(thread_store);
851 
852  return TM_ECODE_OK;
853 }
854 
856  OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
857 {
858  BUG_ON(LogFunc == NULL);
859 
860  RootLogger *logger = SCCalloc(1, sizeof(*logger));
861  if (logger == NULL) {
862  FatalError("failed to alloc root logger");
863  }
864  logger->ThreadInit = ThreadInit;
865  logger->ThreadDeinit = ThreadDeinit;
866  logger->LogFunc = LogFunc;
867  logger->ActiveCntFunc = ActiveCntFunc;
868  TAILQ_INSERT_TAIL(&registered_loggers, logger, entries);
869 }
870 
871 static void OutputRegisterActiveLogger(RootLogger *reg)
872 {
873  RootLogger *logger = SCCalloc(1, sizeof(*logger));
874  if (logger == NULL) {
875  FatalError("failed to alloc root logger");
876  }
877  logger->ThreadInit = reg->ThreadInit;
878  logger->ThreadDeinit = reg->ThreadDeinit;
879  logger->LogFunc = reg->LogFunc;
880  logger->ActiveCntFunc = reg->ActiveCntFunc;
881  TAILQ_INSERT_TAIL(&active_loggers, logger, entries);
882 }
883 
885 {
886  RootLogger *logger = TAILQ_FIRST(&registered_loggers);
887  while (logger) {
888  uint32_t cnt = logger->ActiveCntFunc();
889  if (cnt) {
890  OutputRegisterActiveLogger(logger);
891  }
892 
893  logger = TAILQ_NEXT(logger, entries);
894  }
895 }
896 
898 {
899  RootLogger *logger;
900  while ((logger = TAILQ_FIRST(&active_loggers)) != NULL) {
901  TAILQ_REMOVE(&active_loggers, logger, entries);
902  SCFree(logger);
903  }
904 }
905 
907 {
910 }
911 
913 {
914  if (alproto < g_alproto_max) {
915  return &simple_json_applayer_loggers[alproto];
916  }
917  return NULL;
918 }
919 
920 static void RegisterSimpleJsonApplayerLogger(
921  AppProto alproto, EveJsonSimpleTxLogFunc LogTx, const char *name)
922 {
923  simple_json_applayer_loggers[alproto].LogTx = LogTx;
924  if (name) {
925  simple_json_applayer_loggers[alproto].name = name;
926  } else {
927  simple_json_applayer_loggers[alproto].name = AppProtoToString(alproto);
928  }
929 }
930 
931 /**
932  * \brief Register all root loggers.
933  */
935 {
936  simple_json_applayer_loggers = SCCalloc(g_alproto_max, sizeof(EveJsonSimpleAppLayerLogger));
937  if (unlikely(simple_json_applayer_loggers == NULL)) {
938  FatalError("Failed to allocate simple_json_applayer_loggers");
939  }
940  // ALPROTO_HTTP1 special: uses some options flags
941  RegisterSimpleJsonApplayerLogger(ALPROTO_FTP, (EveJsonSimpleTxLogFunc)EveFTPLogCommand, NULL);
942  // ALPROTO_SMTP special: uses state
943  RegisterSimpleJsonApplayerLogger(
945  // no cast here but done in rust for SSHTransaction
946  RegisterSimpleJsonApplayerLogger(ALPROTO_SSH, (EveJsonSimpleTxLogFunc)SCSshLogJson, NULL);
947  // ALPROTO_SMB special: uses state
948  // ALPROTO_DCERPC special: uses state
949  RegisterSimpleJsonApplayerLogger(ALPROTO_DNS, (EveJsonSimpleTxLogFunc)AlertJsonDns, NULL);
950  RegisterSimpleJsonApplayerLogger(ALPROTO_MDNS, (EveJsonSimpleTxLogFunc)AlertJsonMdns, NULL);
951  // either need a cast here or in rust for ModbusTransaction, done here
952  RegisterSimpleJsonApplayerLogger(ALPROTO_MODBUS, (EveJsonSimpleTxLogFunc)SCModbusToJson, NULL);
953  RegisterSimpleJsonApplayerLogger(ALPROTO_ENIP, (EveJsonSimpleTxLogFunc)SCEnipLoggerLog, NULL);
954  RegisterSimpleJsonApplayerLogger(ALPROTO_DNP3, (EveJsonSimpleTxLogFunc)AlertJsonDnp3, NULL);
955  // ALPROTO_NFS special: uses state
956  // underscore instead of dash for ftp_data
957  RegisterSimpleJsonApplayerLogger(
959  RegisterSimpleJsonApplayerLogger(
960  ALPROTO_TFTP, (EveJsonSimpleTxLogFunc)SCTftpLogJsonRequest, NULL);
961  // ALPROTO_IKE special: uses state
962  RegisterSimpleJsonApplayerLogger(
963  ALPROTO_KRB5, (EveJsonSimpleTxLogFunc)SCKrb5LogJsonResponse, NULL);
964  RegisterSimpleJsonApplayerLogger(ALPROTO_QUIC, (EveJsonSimpleTxLogFunc)SCQuicLogJson, NULL);
965  // ALPROTO_DHCP TODO missing
966  RegisterSimpleJsonApplayerLogger(ALPROTO_SIP, (EveJsonSimpleTxLogFunc)SCSipLogJson, NULL);
967  RegisterSimpleJsonApplayerLogger(ALPROTO_RFB, (EveJsonSimpleTxLogFunc)SCRfbJsonLogger, NULL);
968  RegisterSimpleJsonApplayerLogger(ALPROTO_POP3, (EveJsonSimpleTxLogFunc)SCPop3LoggerLog, NULL);
969  RegisterSimpleJsonApplayerLogger(
971  RegisterSimpleJsonApplayerLogger(
973  RegisterSimpleJsonApplayerLogger(
974  ALPROTO_WEBSOCKET, (EveJsonSimpleTxLogFunc)SCWebSocketLoggerLog, NULL);
975  RegisterSimpleJsonApplayerLogger(ALPROTO_LDAP, (EveJsonSimpleTxLogFunc)SCLdapLoggerLog, NULL);
976  RegisterSimpleJsonApplayerLogger(ALPROTO_DOH2, (EveJsonSimpleTxLogFunc)AlertJsonDoh2, NULL);
977  RegisterSimpleJsonApplayerLogger(
978  ALPROTO_TEMPLATE, (EveJsonSimpleTxLogFunc)SCTemplateLoggerLog, NULL);
979  RegisterSimpleJsonApplayerLogger(ALPROTO_RDP, (EveJsonSimpleTxLogFunc)SCRdpToJson, NULL);
980  // special case : http2 is logged in http object
981  RegisterSimpleJsonApplayerLogger(ALPROTO_HTTP2, (EveJsonSimpleTxLogFunc)SCHttp2LogJson, "http");
982  // underscore instead of dash for bittorrent_dht
983  RegisterSimpleJsonApplayerLogger(ALPROTO_BITTORRENT_DHT,
984  (EveJsonSimpleTxLogFunc)SCBittorrentDhtLogger, "bittorrent_dht");
985 
991 }
992 
993 static int JsonGenericLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
994  void *state, void *tx, uint64_t tx_id, int dir)
995 {
996  OutputJsonThreadCtx *thread = thread_data;
998  if (al == NULL) {
999  return TM_ECODE_FAILED;
1000  }
1001 
1002  SCJsonBuilder *js = CreateEveHeader(p, dir, al->name, NULL, thread->ctx);
1003  if (unlikely(js == NULL)) {
1004  return TM_ECODE_FAILED;
1005  }
1006 
1007  if (!al->LogTx(tx, js)) {
1008  goto error;
1009  }
1010 
1011  OutputJsonBuilderBuffer(tv, p, p->flow, js, thread);
1012  SCJbFree(js);
1013 
1014  return TM_ECODE_OK;
1015 
1016 error:
1017  SCJbFree(js);
1018  return TM_ECODE_FAILED;
1019 }
1020 
1021 static int JsonGenericDirPacketLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
1022  void *state, void *tx, uint64_t tx_id)
1023 {
1024  return JsonGenericLogger(tv, thread_data, p, f, state, tx, tx_id, LOG_DIR_PACKET);
1025 }
1026 
1027 static int JsonGenericDirFlowLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
1028  void *state, void *tx, uint64_t tx_id)
1029 {
1030  return JsonGenericLogger(tv, thread_data, p, f, state, tx, tx_id, LOG_DIR_FLOW);
1031 }
1032 
1033 #define ARRAY_CAP_STEP 16
1034 static EveJsonTxLoggerRegistrationData *preregistered_loggers = NULL;
1035 static size_t preregistered_loggers_nb = 0;
1036 static size_t preregistered_loggers_cap = 0;
1037 
1038 // Plugins can preregister logger with this function :
1039 // When an app-layer plugin is loaded, it wants to register its logger
1040 // But the plugin is loaded before loggers can register
1041 // The preregistration data will later be used by OutputRegisterLoggers
1043 {
1044  if (preregistered_loggers_nb == preregistered_loggers_cap) {
1045  void *tmp = SCRealloc(
1046  preregistered_loggers, sizeof(EveJsonTxLoggerRegistrationData) *
1047  (preregistered_loggers_cap + ARRAY_CAP_STEP));
1048  if (tmp == NULL) {
1049  return 1;
1050  }
1051  preregistered_loggers_cap += ARRAY_CAP_STEP;
1052  preregistered_loggers = tmp;
1053  }
1054  preregistered_loggers[preregistered_loggers_nb] = reg_data;
1055  preregistered_loggers_nb++;
1056  return 0;
1057 }
1058 
1059 static TxLogger JsonLoggerFromDir(uint8_t dir)
1060 {
1061  if (dir == LOG_DIR_PACKET) {
1062  return JsonGenericDirPacketLogger;
1063  }
1064  BUG_ON(dir != LOG_DIR_FLOW);
1065  return JsonGenericDirFlowLogger;
1066 }
1067 
1068 /**
1069  * \brief Register all non-root logging modules.
1070  */
1072 {
1073  /* custom format log*/
1075 
1076  LuaLogRegister();
1077  /* fast log */
1079  /* debug log */
1081  /* syslog log */
1085  /* json log */
1087  /* email logs */
1089  /* http log */
1092  OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_TX, "eve-log", "LogHttp2Log", "eve-log.http2",
1093  OutputJsonLogInitSub, ALPROTO_HTTP2, JsonGenericDirFlowLogger, HTTP2StateClosed,
1094  HTTP2StateClosed, JsonLogThreadInit, JsonLogThreadDeinit);
1095  /* tls log */
1098  /* ssh */
1099  OutputRegisterTxSubModuleWithCondition(LOGGER_JSON_TX, "eve-log", "JsonSshLog", "eve-log.ssh",
1100  OutputJsonLogInitSub, ALPROTO_SSH, JsonGenericDirFlowLogger, SSHTxLogCondition,
1102  /* pcap log */
1103  PcapLogRegister();
1104  /* file log */
1107  /* dns */
1109  /* mdns */
1111  /* modbus */
1112  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonModbusLog", "eve-log.modbus",
1113  OutputJsonLogInitSub, ALPROTO_MODBUS, JsonGenericDirFlowLogger, JsonLogThreadInit,
1115 
1116  SCLogDebug("modbus json logger registered.");
1117  /* tcp streaming data */
1119  /* log stats */
1121 
1124  /* flow/netflow */
1127  /* json stats */
1129 
1130  /* DNP3. */
1133 
1134  /* NFS JSON logger. */
1136  /* TFTP JSON logger. */
1137  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTFTPLog", "eve-log.tftp",
1138  OutputJsonLogInitSub, ALPROTO_TFTP, JsonGenericDirPacketLogger, JsonLogThreadInit,
1140 
1141  SCLogDebug("TFTP JSON logger registered.");
1142  /* FTP and FTP-DATA JSON loggers. */
1143  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
1144  OutputJsonLogInitSub, ALPROTO_FTP, JsonGenericDirFlowLogger, JsonLogThreadInit,
1146  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
1147  OutputJsonLogInitSub, ALPROTO_FTPDATA, JsonGenericDirFlowLogger, JsonLogThreadInit,
1149  SCLogDebug("FTP JSON logger registered.");
1150 
1151  /* SMB JSON logger. */
1153  /* IKE JSON logger. */
1155  /* KRB5 JSON logger. */
1156  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonKRB5Log", "eve-log.krb5",
1157  OutputJsonLogInitSub, ALPROTO_KRB5, JsonGenericDirPacketLogger, JsonLogThreadInit,
1159 
1160  SCLogDebug("KRB5 JSON logger registered.");
1161  /* QUIC JSON logger. */
1162  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonQuicLog", "eve-log.quic",
1163  OutputJsonLogInitSub, ALPROTO_QUIC, JsonGenericDirPacketLogger, JsonLogThreadInit,
1165 
1166  SCLogDebug("quic json logger registered.");
1167  /* DHCP JSON logger. */
1169 
1170  /* SIP JSON logger. */
1171  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSIPLog", "eve-log.sip",
1172  OutputJsonLogInitSub, ALPROTO_SIP, JsonGenericDirPacketLogger, JsonLogThreadInit,
1174 
1175  SCLogDebug("SIP JSON logger registered.");
1176  /* RFB JSON logger. */
1177  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRFBLog", "eve-log.rfb",
1178  OutputJsonLogInitSub, ALPROTO_RFB, JsonGenericDirPacketLogger, JsonLogThreadInit,
1180  /* MQTT JSON logger. */
1182  /* Pgsql JSON logger. */
1184  /* WebSocket JSON logger. */
1185  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonWebSocketLog", "eve-log.websocket",
1186  OutputJsonLogInitSub, ALPROTO_WEBSOCKET, JsonGenericDirPacketLogger, JsonLogThreadInit,
1188  /* Enip JSON logger. */
1189  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonEnipLog", "eve-log.enip",
1190  OutputJsonLogInitSub, ALPROTO_ENIP, JsonGenericDirFlowLogger, JsonLogThreadInit,
1192  /* Ldap JSON logger. */
1193  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonLdapLog", "eve-log.ldap",
1194  OutputJsonLogInitSub, ALPROTO_LDAP, JsonGenericDirFlowLogger, JsonLogThreadInit,
1196  /* DoH2 JSON logger. */
1198  /* POP3 JSON logger */
1199  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonPop3Log", "eve-log.pop3",
1200  OutputJsonLogInitSub, ALPROTO_POP3, JsonGenericDirFlowLogger, JsonLogThreadInit,
1202  /* Mdns JSON logger. */
1203  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonMdnsLog", "eve-log.template",
1204  OutputJsonLogInitSub, ALPROTO_MDNS, JsonGenericDirPacketLogger, JsonLogThreadInit,
1206  /* Template JSON logger. */
1207  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTemplateLog", "eve-log.template",
1208  OutputJsonLogInitSub, ALPROTO_TEMPLATE, JsonGenericDirPacketLogger, JsonLogThreadInit,
1210  /* RDP JSON logger. */
1211  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRdpLog", "eve-log.rdp",
1212  OutputJsonLogInitSub, ALPROTO_RDP, JsonGenericDirPacketLogger, JsonLogThreadInit,
1214  SCLogDebug("rdp json logger registered.");
1215  /* DCERPC JSON logger. */
1217  /* app layer frames */
1219  /* BitTorrent DHT JSON logger */
1220  if (SCConfGetNode("app-layer.protocols.bittorrent-dht") != NULL) {
1221  /* Register as an eve sub-module. */
1222  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonBitTorrentDHTLog",
1223  "eve-log.bittorrent-dht", OutputJsonLogInitSub, ALPROTO_BITTORRENT_DHT,
1224  JsonGenericDirPacketLogger, JsonLogThreadInit, JsonLogThreadDeinit);
1225  }
1226  /* ARP JSON logger */
1228 
1229  for (size_t i = 0; i < preregistered_loggers_nb; i++) {
1230  OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", preregistered_loggers[i].logname,
1231  preregistered_loggers[i].confname, OutputJsonLogInitSub,
1232  preregistered_loggers[i].alproto, JsonLoggerFromDir(preregistered_loggers[i].dir),
1234  SCLogDebug(
1235  "%s JSON logger registered.", AppProtoToString(preregistered_loggers[i].alproto));
1236  RegisterSimpleJsonApplayerLogger(preregistered_loggers[i].alproto,
1237  (EveJsonSimpleTxLogFunc)preregistered_loggers[i].LogTx, NULL);
1238  }
1239 }
RootLogger_::ThreadDeinit
ThreadDeinitFunc ThreadDeinit
Definition: output.c:90
log-stats.h
JsonMQTTAddMetadata
bool JsonMQTTAddMetadata(void *vtx, SCJsonBuilder *js)
Definition: output-json-mqtt.c:63
OutputModule_::parent_name
const char * parent_name
Definition: output.h:60
OutputFileRolloverFlag
OutputFileRolloverFlag
Definition: output.c:126
LogTlsStoreRegister
void LogTlsStoreRegister(void)
Definition: log-tlsstore.c:497
tm-threads.h
OutputModule_::FileLogFunc
SCFileLogger FileLogFunc
Definition: output.h:71
output-json-ftp.h
OutputDropLoggerEnable
int OutputDropLoggerEnable(void)
Definition: output.c:668
OutputRegisterStreamingModule
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.
Definition: output.c:528
LoggerThreadStoreNode
LoggerThreadStoreNode
Definition: output.c:110
OutputLogFunc
TmEcode(* OutputLogFunc)(ThreadVars *, Packet *, void *)
Definition: output.h:53
JsonDoh2LogRegister
void JsonDoh2LogRegister(void)
Definition: output-json-dns.c:695
app-layer-ssh.h
JsonDCERPCLogRegister
void JsonDCERPCLogRegister(void)
Definition: output-json-dcerpc.c:67
OutputTxLoggerRegister
void OutputTxLoggerRegister(void)
Definition: output-tx.c:656
alert-debuglog.h
TAILQ_INIT
#define TAILQ_INIT(head)
Definition: queue.h:262
JsonPgsqlLogRegister
void JsonPgsqlLogRegister(void)
Definition: output-json-pgsql.c:184
ALPROTO_DNS
@ ALPROTO_DNS
Definition: app-layer-protos.h:47
OutputJsonThreadCtx_::ctx
OutputJsonCtx * ctx
Definition: output-json.h:86
JsonTlsLogJSONExtended
bool JsonTlsLogJSONExtended(void *vtx, SCJsonBuilder *tjs)
Definition: output-json-tls.c:523
ALPROTO_ENIP
@ ALPROTO_ENIP
Definition: app-layer-protos.h:49
OutputRegisterTxSubModuleWithProgress
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: output.c:377
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
EveFTPDataAddMetadata
bool EveFTPDataAddMetadata(void *vtx, SCJsonBuilder *jb)
Definition: app-layer-ftp.c:1394
JsonSMBLogRegister
void JsonSMBLogRegister(void)
Definition: output-json-smb.c:151
ALPROTO_TLS
@ ALPROTO_TLS
Definition: app-layer-protos.h:39
OutputRegisterRootLogger
void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
Definition: output.c:855
output-json-mqtt.h
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
output-eve-stream.h
OutputFileLoggerRegister
void OutputFileLoggerRegister(void)
Definition: output-file.c:235
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
name
const char * name
Definition: detect-engine-proto.c:48
ALPROTO_MODBUS
@ ALPROTO_MODBUS
Definition: app-layer-protos.h:48
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:86
ALPROTO_QUIC
@ ALPROTO_QUIC
Definition: app-layer-protos.h:57
SCFileLogger
int(* SCFileLogger)(ThreadVars *, void *thread_data, const Packet *, const File *, void *tx, const uint64_t tx_id, uint8_t direction)
Definition: output-file.h:48
ALPROTO_POP3
@ ALPROTO_POP3
Definition: app-layer-protos.h:71
SCEveJsonSimpleGetLogger
EveJsonSimpleAppLayerLogger * SCEveJsonSimpleGetLogger(AppProto alproto)
Definition: output.c:912
CreateEveHeader
SCJsonBuilder * CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:819
JsonLogThreadInit
TmEcode JsonLogThreadInit(ThreadVars *t, const void *initdata, void **data)
Definition: output-json-common.c:90
OutputModule_::name
const char * name
Definition: output.h:58
Flow_
Flow data structure.
Definition: flow.h:347
OutputModule_::logger_id
LoggerId logger_id
Definition: output.h:57
LoggerId
LoggerId
Definition: suricata-common.h:477
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:41
AlertFastLogRegister
void AlertFastLogRegister(void)
Definition: alert-fastlog.c:77
output-json-pgsql.h
JsonFileLogRegister
void JsonFileLogRegister(void)
Definition: output-json-file.c:352
AlertJsonDns
bool AlertJsonDns(void *txptr, SCJsonBuilder *js)
Definition: output-json-dns.c:252
output-json-frame.h
OutputModule_::ts_log_progress
int ts_log_progress
Definition: output.h:79
OutputRegisterStatsSubModule
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.
Definition: output.c:602
output-json-netflow.h
JsonDNP3LogRegister
void JsonDNP3LogRegister(void)
Definition: output-json-dnp3.c:350
LogCustomFormatRegister
void LogCustomFormatRegister(void)
Definition: log-cf-common.c:273
SCOutputEvePreRegisterLogger
int SCOutputEvePreRegisterLogger(EveJsonTxLoggerRegistrationData reg_data)
Definition: output.c:1042
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:252
output-json-arp.h
OutputGetModuleByConfName
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
Definition: output.c:637
output-json-tls.h
OutputInitFunc
OutputInitResult(* OutputInitFunc)(SCConfNode *)
Definition: output.h:51
SSHTxLogCondition
bool SSHTxLogCondition(ThreadVars *tv, const Packet *p, void *state, void *tx, uint64_t tx_id)
Definition: app-layer-ssh.c:74
ALPROTO_SIP
@ ALPROTO_SIP
Definition: app-layer-protos.h:59
OutputRegisterTxSubModule
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: output.c:402
OutputSetupActiveLoggers
void OutputSetupActiveLoggers(void)
Definition: output.c:884
AlertSyslogRegister
void AlertSyslogRegister(void)
Function to register the AlertSyslog module.
Definition: alert-syslog.c:387
OutputModule_::StatsLogFunc
StatsLogger StatsLogFunc
Definition: output.h:75
SCMutexLock
#define SCMutexLock(mut)
Definition: threads-debug.h:117
ALPROTO_LDAP
@ ALPROTO_LDAP
Definition: app-layer-protos.h:65
JsonDHCPLogRegister
void JsonDHCPLogRegister(void)
Definition: output-json-dhcp.c:145
TxLogger
int(* TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id)
Transaction logger function pointer type.
Definition: output-tx.h:34
FlowLogger
int(* FlowLogger)(ThreadVars *, void *thread_data, Flow *f)
Flow logger function pointer type.
Definition: output-flow.h:36
ALPROTO_FTP
@ ALPROTO_FTP
Definition: app-layer-protos.h:37
SCMUTEX_INITIALIZER
#define SCMUTEX_INITIALIZER
Definition: threads-debug.h:122
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:994
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:294
PcapLogRegister
void PcapLogRegister(void)
Definition: log-pcap.c:220
OutputModule_::InitSubFunc
OutputInitSubFunc InitSubFunc
Definition: output.h:62
OutputRegisterFiledataModule
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.
Definition: output.c:455
SCFiledataLogger
int(* SCFiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx, const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
File-data logger function pointer type.
Definition: output-filedata.h:51
ALPROTO_SSH
@ ALPROTO_SSH
Definition: app-layer-protos.h:40
app-layer-ftp.h
OutputModule_::PacketLogFunc
PacketLogger PacketLogFunc
Definition: output.h:67
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
OutputModule_::FiledataLogFunc
SCFiledataLogger FiledataLogFunc
Definition: output.h:72
JsonStatsLogRegister
void JsonStatsLogRegister(void)
Definition: output-json-stats.c:502
LogTcpDataLogRegister
void LogTcpDataLogRegister(void)
Definition: log-tcp-data.c:46
SCOnLoggingReadyCallback
void(* SCOnLoggingReadyCallback)(void *arg)
Definition: output.h:159
OutputRegisterRootLoggers
void OutputRegisterRootLoggers(void)
Register all root loggers.
Definition: output.c:934
OutputLoggerThreadDeinit
TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data)
Definition: output.c:829
OutputRegisterTxModule
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.
Definition: output.c:394
OutputModule_::alproto
AppProto alproto
Definition: output.h:76
JsonTlsLogRegister
void JsonTlsLogRegister(void)
Definition: output-json-tls.c:732
OutputRegisterFileSubModule
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.
Definition: output.c:418
alert-syslog.h
JsonFlowLogRegister
void JsonFlowLogRegister(void)
Definition: output-json-flow.c:452
SCRegisterOnLoggingReady
int SCRegisterOnLoggingReady(SCOnLoggingReadyCallback callback, void *arg)
Register a callback to be called when logging is ready.
Definition: output.c:753
OutputPacketLoggerFunctions_::ConditionFunc
PacketLogCondition ConditionFunc
Definition: output.h:87
TmModuleLoggerRegister
void TmModuleLoggerRegister(void)
Definition: output.c:906
output-json-dcerpc.h
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
JsonPgsqlAddMetadata
bool JsonPgsqlAddMetadata(void *vtx, SCJsonBuilder *jb)
Definition: output-json-pgsql.c:62
OutputJsonRegister
void OutputJsonRegister(void)
Definition: output-json.c:83
OutputClearActiveLoggers
void OutputClearActiveLoggers(void)
Definition: output.c:897
ALPROTO_KRB5
@ ALPROTO_KRB5
Definition: app-layer-protos.h:56
OutputJsonThreadCtx_
Definition: output-json.h:85
TAILQ_ENTRY
#define TAILQ_ENTRY(type)
Definition: queue.h:239
RootLogger_::LogFunc
OutputLogFunc LogFunc
Definition: output.c:88
output-json-dnp3.h
OutputRegisterFileRotationFlag
void OutputRegisterFileRotationFlag(int *flag)
Register a flag for file rotation notification.
Definition: output.c:688
OutputJsonLogInitSub
OutputInitResult OutputJsonLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
Definition: output-json-common.c:73
LogHttpLogRegister
void LogHttpLogRegister(void)
Definition: log-httplog.c:65
OutputRegisterFlowSubModule
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.
Definition: output.c:491
OutputModule_::stream_type
enum SCOutputStreamingType stream_type
Definition: output.h:77
OutputModule_::ThreadInit
ThreadInitFunc ThreadInit
Definition: output.h:64
OutputRegisterTxModuleWithCondition
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.
Definition: output.c:345
TAILQ_HEAD_INITIALIZER
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:236
output_modules
OutputModuleList output_modules
JsonAnomalyLogRegister
void JsonAnomalyLogRegister(void)
Definition: output-json-anomaly.c:448
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:312
util-debug.h
output-json-flow.h
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:250
OutputStreamingLoggerRegister
void OutputStreamingLoggerRegister(void)
Definition: output-streaming.c:432
util-error.h
OutputRegisterStatsModule
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.
Definition: output.c:566
log-tcp-data.h
g_alproto_max
AppProto g_alproto_max
Definition: app-layer-protos.c:30
OutputModule_::ThreadDeinit
ThreadDeinitFunc ThreadDeinit
Definition: output.h:65
ALPROTO_DNP3
@ ALPROTO_DNP3
Definition: app-layer-protos.h:50
output-json.h
SCMutexUnlock
#define SCMutexUnlock(mut)
Definition: threads-debug.h:120
OutputRegisterTxModuleWithProgress
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.
Definition: output.c:369
output-json-file.h
OutputRegisterModule
void OutputRegisterModule(const char *, const char *, OutputInitFunc)
JsonIKELogRegister
void JsonIKELogRegister(void)
Definition: output-json-ike.c:182
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
JsonMdnsLogRegister
void JsonMdnsLogRegister(void)
Definition: output-json-mdns.c:155
ThreadInitFunc
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:43
OutputModule_::StreamingLogFunc
SCStreamingLogger StreamingLogFunc
Definition: output.h:74
OutputLoggerThreadInit
TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
Definition: output.c:798
LOG_DIR_FLOW
@ LOG_DIR_FLOW
Definition: output-eve-bindgen.h:35
app-layer-parser.h
JsonMQTTLogRegister
void JsonMQTTLogRegister(void)
Definition: output-json-mqtt.c:192
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:317
OutputFilestoreRegister
void OutputFilestoreRegister(void)
Definition: output-filestore.c:527
OutputRegisterLoggers
void OutputRegisterLoggers(void)
Register all non-root logging modules.
Definition: output.c:1071
OutputModule_::conf_name
const char * conf_name
Definition: output.h:59
output-json-anomaly.h
OutputModule_::FlowLogFunc
FlowLogger FlowLogFunc
Definition: output.h:73
OutputDeregisterAll
void OutputDeregisterAll(void)
Deregister all modules. Useful for a memory clean exit.
Definition: output.c:654
Packet_
Definition: decode.h:505
RootLogger_::ActiveCntFunc
OutputGetActiveCountFunc ActiveCntFunc
Definition: output.c:91
OutputPacketLoggerRegister
void OutputPacketLoggerRegister(void)
Definition: output-packet.c:194
EveJsonTxLoggerRegistrationData
Definition: output-eve-bindgen.h:49
ALPROTO_RDP
@ ALPROTO_RDP
Definition: app-layer-protos.h:68
conf.h
OutputNotifyFileRotation
void OutputNotifyFileRotation(void)
Notifies all registered file rotation notification flags.
Definition: output.c:731
TAILQ_HEAD
typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_)
Definition: output.c:112
TmEcode
TmEcode
Definition: tm-threads-common.h:80
ALPROTO_DOH2
@ ALPROTO_DOH2
Definition: app-layer-protos.h:66
EveStreamLogRegister
void EveStreamLogRegister(void)
Definition: output-eve-stream.c:453
ALPROTO_TFTP
@ ALPROTO_TFTP
Definition: app-layer-protos.h:54
RootLogger_::ThreadInit
ThreadInitFunc ThreadInit
Definition: output.c:89
ALPROTO_HTTP2
@ ALPROTO_HTTP2
Definition: app-layer-protos.h:69
EveJsonSimpleAppLayerLogger
Definition: output-eve-bindgen.h:42
TAILQ_FOREACH_SAFE
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:329
log-pcap.h
SCRealloc
#define SCRealloc(ptr, sz)
Definition: util-mem.h:50
alert-fastlog.h
TxLoggerCondition
bool(* TxLoggerCondition)(ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id)
Transaction logger condition function pointer type.
Definition: output-tx.h:41
LogStatsLogRegister
void LogStatsLogRegister(void)
Definition: log-stats.c:285
OutputPacketLoggerFunctions_::ThreadDeinitFunc
ThreadDeinitFunc ThreadDeinitFunc
Definition: output.h:89
JsonFrameLogRegister
void JsonFrameLogRegister(void)
Definition: output-json-frame.c:551
cnt
uint32_t cnt
Definition: tmqh-packetpool.h:7
Packet_::flow
struct Flow_ * flow
Definition: decode.h:553
OutputModule_::TxLogCondition
TxLoggerCondition TxLogCondition
Definition: output.h:70
suricata-common.h
output-json-stats.h
EveJsonSimpleAppLayerLogger::LogTx
EveJsonSimpleTxLogFunc LogTx
Definition: output-eve-bindgen.h:43
ARRAY_CAP_STEP
#define ARRAY_CAP_STEP
Definition: output.c:1033
output-json-nfs.h
EveJsonSimpleAppLayerLogger::name
const char * name
Definition: output-eve-bindgen.h:44
ALPROTO_PGSQL
@ ALPROTO_PGSQL
Definition: app-layer-protos.h:62
TAILQ_NEXT
#define TAILQ_NEXT(elm, field)
Definition: queue.h:307
OutputPacketLoggerFunctions_::LogFunc
PacketLogger LogFunc
Definition: output.h:86
OutputRegisterPacketModule
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, OutputPacketLoggerFunctions *output_module_functions)
Register a packet output module.
Definition: output.c:194
ALPROTO_FTPDATA
@ ALPROTO_FTPDATA
Definition: app-layer-protos.h:53
output-filestore.h
output-json-mdns.h
FatalError
#define FatalError(...)
Definition: util-debug.h:517
LuaLogRegister
void LuaLogRegister(void)
Definition: output-lua.c:931
ALPROTO_WEBSOCKET
@ ALPROTO_WEBSOCKET
Definition: app-layer-protos.h:64
OutputRegisterPacketSubModule
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.
Definition: output.c:231
JsonSmtpLogRegister
void JsonSmtpLogRegister(void)
Definition: output-json-smtp.c:192
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:33
log-httplog.h
JsonMetadataLogRegister
void JsonMetadataLogRegister(void)
Definition: output-json-metadata.c:95
output-json-alert.h
OutputModule_::PacketConditionFunc
PacketLogCondition PacketConditionFunc
Definition: output.h:68
RootLogger
struct RootLogger_ RootLogger
output-json-dns.h
OutputGetActiveCountFunc
uint32_t(* OutputGetActiveCountFunc)(void)
Definition: output.h:54
OutputPacketLoggerFunctions_::ThreadInitFunc
ThreadInitFunc ThreadInitFunc
Definition: output.h:88
log-cf-common.h
output-json-metadata.h
LOGGER_JSON_TX
@ LOGGER_JSON_TX
Definition: suricata-common.h:485
JsonDnsLogRegister
void JsonDnsLogRegister(void)
Definition: output-json-dns.c:688
output-eve.h
EVE logging subsystem.
EveFTPLogCommand
bool EveFTPLogCommand(void *vtx, SCJsonBuilder *jb)
Definition: output-json-ftp.c:49
SCConfGetNode
SCConfNode * SCConfGetNode(const char *name)
Get a SCConfNode by name.
Definition: conf.c:182
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
OutputLoggerLog
TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
Definition: output.c:784
SCFree
#define SCFree(p)
Definition: util-mem.h:61
output-json-dhcp.h
ALPROTO_MDNS
@ ALPROTO_MDNS
Definition: app-layer-protos.h:72
JsonDropLogRegister
void JsonDropLogRegister(void)
Definition: output-json-drop.c:391
output-json-ike.h
StatsLogger
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
Definition: output-stats.h:50
OutputModule_::TxLogFunc
TxLogger TxLogFunc
Definition: output.h:69
ALPROTO_MQTT
@ ALPROTO_MQTT
Definition: app-layer-protos.h:61
OutputModule_::tc_log_progress
int tc_log_progress
Definition: output.h:78
OnLoggingReadyCallbackNode
OnLoggingReadyCallbackNode
Definition: output.c:147
AlertJsonDnp3
bool AlertJsonDnp3(void *vtx, SCJsonBuilder *js)
Definition: output-json-dnp3.c:197
ALPROTO_TEMPLATE
@ ALPROTO_TEMPLATE
Definition: app-layer-protos.h:67
output-lua.h
SCOnLoggingReady
void SCOnLoggingReady(void)
Invokes all registered logging ready callbacks.
Definition: output.c:774
ALPROTO_RFB
@ ALPROTO_RFB
Definition: app-layer-protos.h:60
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-eve-bindgen.h:34
JsonHttpLogRegister
void JsonHttpLogRegister(void)
Definition: output-json-http.c:637
ALPROTO_BITTORRENT_DHT
@ ALPROTO_BITTORRENT_DHT
Definition: app-layer-protos.h:70
output-json-smb.h
JsonArpLogRegister
void JsonArpLogRegister(void)
Definition: output-json-arp.c:104
SCOutputStreamingType
SCOutputStreamingType
Definition: output-streaming.h:35
AlertJsonMdns
bool AlertJsonMdns(void *txptr, SCJsonBuilder *js)
Definition: output-json-mdns.c:42
output-json-smtp.h
JsonLogThreadDeinit
TmEcode JsonLogThreadDeinit(ThreadVars *t, void *data)
Definition: output-json-common.c:123
output-json-http.h
flow.h
OutputModule_
Definition: output.h:56
AlertDebugLogRegister
void AlertDebugLogRegister(void)
Definition: alert-debuglog.c:485
OutputUnregisterFileRotationFlag
void OutputUnregisterFileRotationFlag(int *flag)
Unregister a file rotation flag.
Definition: output.c:711
OutputRegisterTxSubModuleWithCondition
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: output.c:353
log-tlsstore.h
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:443
EveJsonSimpleTxLogFunc
bool(* EveJsonSimpleTxLogFunc)(const void *, void *)
Definition: output-eve-bindgen.h:40
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
OutputFiledataLoggerRegister
void OutputFiledataLoggerRegister(void)
Definition: output-filedata.c:269
AlertJsonDoh2
bool AlertJsonDoh2(void *txptr, SCJsonBuilder *js)
Definition: output-json-dns.c:258
OutputPacketLoggerFunctions_
Definition: output.h:85
SCMutex
#define SCMutex
Definition: threads-debug.h:114
OutputInitSubFunc
OutputInitResult(* OutputInitSubFunc)(SCConfNode *, OutputCtx *)
Definition: output.h:52
SCStreamingLogger
int(* SCStreamingLogger)(ThreadVars *, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
Definition: output-streaming.h:41
output.h
JsonAlertLogRegister
void JsonAlertLogRegister(void)
Definition: output-json-alert.c:1101
JsonNFSLogRegister
void JsonNFSLogRegister(void)
Definition: output-json-nfs.c:109
OutputDropLoggerDisable
void OutputDropLoggerDisable(void)
Definition: output.c:676
JsonNetFlowLogRegister
void JsonNetFlowLogRegister(void)
Definition: output-json-netflow.c:313
ThreadDeinitFunc
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:44
OutputModule_::InitFunc
OutputInitFunc InitFunc
Definition: output.h:61
RootLogger_
Definition: output.c:87
output-json-drop.h