suricata
output.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2016 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 
43 #include "alert-fastlog.h"
44 #include "alert-unified2-alert.h"
45 #include "alert-debuglog.h"
46 #include "alert-prelude.h"
47 #include "alert-syslog.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 "log-droplog.h"
54 #include "output-json-drop.h"
55 #include "log-httplog.h"
56 #include "output-json-http.h"
57 #include "output-json-dns.h"
58 #include "log-tlslog.h"
59 #include "log-tlsstore.h"
60 #include "output-json-tls.h"
61 #include "output-json-ssh.h"
62 #include "log-pcap.h"
63 #include "output-json-file.h"
64 #include "output-json-smtp.h"
65 #include "output-json-stats.h"
66 #include "log-filestore.h"
67 #include "log-tcp-data.h"
68 #include "log-stats.h"
69 #include "output-json.h"
70 #include "output-json-nfs.h"
71 #include "output-json-tftp.h"
72 #include "output-json-smb.h"
73 #include "output-json-ikev2.h"
74 #include "output-json-krb5.h"
75 #include "output-json-dhcp.h"
76 #include "output-json-snmp.h"
77 #include "output-json-template.h"
79 #include "output-lua.h"
80 #include "output-json-dnp3.h"
81 #include "output-json-metadata.h"
82 #include "output-filestore.h"
83 
84 typedef struct RootLogger_ {
89 
90  TAILQ_ENTRY(RootLogger_) entries;
91 } RootLogger;
92 
93 static TAILQ_HEAD(, RootLogger_) RootLoggers =
94  TAILQ_HEAD_INITIALIZER(RootLoggers);
95 
96 typedef struct LoggerThreadStoreNode_ {
97  void *thread_data;
98  TAILQ_ENTRY(LoggerThreadStoreNode_) entries;
100 
101 typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_) LoggerThreadStore;
102 
103 /**
104  * The list of all registered (known) output modules.
105  */
107 
108 /**
109  * Registry of flags to be updated on file rotation notification.
110  */
111 typedef struct OutputFileRolloverFlag_ {
112  int *flag;
113 
114  TAILQ_ENTRY(OutputFileRolloverFlag_) entries;
116 
117 TAILQ_HEAD(, OutputFileRolloverFlag_) output_file_rotation_flags =
118  TAILQ_HEAD_INITIALIZER(output_file_rotation_flags);
119 
120 void OutputRegisterRootLoggers(void);
121 void OutputRegisterLoggers(void);
122 
123 /**
124  * \brief Register an output module.
125  *
126  * This function will register an output module so it can be
127  * configured with the configuration file.
128  *
129  * \retval Returns 0 on success, -1 on failure.
130  */
131 void OutputRegisterModule(const char *name, const char *conf_name,
132  OutputInitFunc InitFunc)
133 {
134  OutputModule *module = SCCalloc(1, sizeof(*module));
135  if (unlikely(module == NULL))
136  goto error;
137 
138  module->name = name;
139  module->conf_name = conf_name;
140  module->InitFunc = InitFunc;
141  TAILQ_INSERT_TAIL(&output_modules, module, entries);
142 
143  SCLogDebug("Output module \"%s\" registered.", name);
144 
145  return;
146 
147 error:
148  SCLogError(SC_ERR_FATAL, "Fatal error encountered in OutputRegisterModule. Exiting...");
149  exit(EXIT_FAILURE);
150 }
151 
152 /**
153  * \brief Register a packet output module.
154  *
155  * This function will register an output module so it can be
156  * configured with the configuration file.
157  *
158  * \retval Returns 0 on success, -1 on failure.
159  */
160 void OutputRegisterPacketModule(LoggerId id, const char *name,
161  const char *conf_name, OutputInitFunc InitFunc,
162  PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
163  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
164  ThreadExitPrintStatsFunc ThreadExitPrintStats)
165 {
166  if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
167  goto error;
168  }
169 
170  OutputModule *module = SCCalloc(1, sizeof(*module));
171  if (unlikely(module == NULL)) {
172  goto error;
173  }
174 
175  module->logger_id = id;
176  module->name = name;
177  module->conf_name = conf_name;
178  module->InitFunc = InitFunc;
179  module->PacketLogFunc = PacketLogFunc;
180  module->PacketConditionFunc = PacketConditionFunc;
181  module->ThreadInit = ThreadInit;
182  module->ThreadDeinit = ThreadDeinit;
184  TAILQ_INSERT_TAIL(&output_modules, module, entries);
185 
186  SCLogDebug("Packet logger \"%s\" registered.", name);
187  return;
188 error:
189  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
190  exit(EXIT_FAILURE);
191 }
192 
193 /**
194  * \brief Register a packet output sub-module.
195  *
196  * This function will register an output module so it can be
197  * configured with the configuration file.
198  *
199  * \retval Returns 0 on success, -1 on failure.
200  */
201 void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
202  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
203  PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
204  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
205  ThreadExitPrintStatsFunc ThreadExitPrintStats)
206 {
207  if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
208  goto error;
209  }
210 
211  OutputModule *module = SCCalloc(1, sizeof(*module));
212  if (unlikely(module == NULL)) {
213  goto error;
214  }
215 
216  module->logger_id = id;
217  module->name = name;
218  module->conf_name = conf_name;
219  module->parent_name = parent_name;
220  module->InitSubFunc = InitFunc;
221  module->PacketLogFunc = PacketLogFunc;
222  module->PacketConditionFunc = PacketConditionFunc;
223  module->ThreadInit = ThreadInit;
224  module->ThreadDeinit = ThreadDeinit;
226  TAILQ_INSERT_TAIL(&output_modules, module, entries);
227 
228  SCLogDebug("Packet logger \"%s\" registered.", name);
229  return;
230 error:
231  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
232  exit(EXIT_FAILURE);
233 }
234 
235 /**
236  * \brief Wrapper function for tx output modules.
237  *
238  * This function will register an output module so it can be
239  * configured with the configuration file.
240  *
241  * \retval Returns 0 on success, -1 on failure.
242  */
243 static void OutputRegisterTxModuleWrapper(LoggerId id, const char *name,
244  const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,
245  TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress,
246  TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit,
247  ThreadDeinitFunc ThreadDeinit,
248  ThreadExitPrintStatsFunc ThreadExitPrintStats)
249 {
250  if (unlikely(TxLogFunc == NULL)) {
251  goto error;
252  }
253 
254  OutputModule *module = SCCalloc(1, sizeof(*module));
255  if (unlikely(module == NULL)) {
256  goto error;
257  }
258 
259  module->logger_id = id;
260  module->name = name;
261  module->conf_name = conf_name;
262  module->InitFunc = InitFunc;
263  module->TxLogFunc = TxLogFunc;
264  module->TxLogCondition = TxLogCondition;
265  module->alproto = alproto;
266  module->tc_log_progress = tc_log_progress;
267  module->ts_log_progress = ts_log_progress;
268  module->ThreadInit = ThreadInit;
269  module->ThreadDeinit = ThreadDeinit;
271  TAILQ_INSERT_TAIL(&output_modules, module, entries);
272 
273  SCLogDebug("Tx logger \"%s\" registered.", name);
274  return;
275 error:
276  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
277  exit(EXIT_FAILURE);
278 }
279 
280 static void OutputRegisterTxSubModuleWrapper(LoggerId id, const char *parent_name,
281  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
282  AppProto alproto, TxLogger TxLogFunc, int tc_log_progress,
283  int ts_log_progress, TxLoggerCondition TxLogCondition,
284  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
285  ThreadExitPrintStatsFunc ThreadExitPrintStats)
286 {
287  if (unlikely(TxLogFunc == NULL)) {
288  goto error;
289  }
290 
291  OutputModule *module = SCCalloc(1, sizeof(*module));
292  if (unlikely(module == NULL)) {
293  goto error;
294  }
295 
296  module->logger_id = id;
297  module->name = name;
298  module->conf_name = conf_name;
299  module->parent_name = parent_name;
300  module->InitSubFunc = InitFunc;
301  module->TxLogFunc = TxLogFunc;
302  module->TxLogCondition = TxLogCondition;
303  module->alproto = alproto;
304  module->tc_log_progress = tc_log_progress;
305  module->ts_log_progress = ts_log_progress;
306  module->ThreadInit = ThreadInit;
307  module->ThreadDeinit = ThreadDeinit;
309  TAILQ_INSERT_TAIL(&output_modules, module, entries);
310 
311  SCLogDebug("Tx logger \"%s\" registered.", name);
312  return;
313 error:
314  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
315  exit(EXIT_FAILURE);
316 }
317 
318 /**
319  * \brief Register a tx output module with condition.
320  *
321  * This function will register an output module so it can be
322  * configured with the configuration file.
323  *
324  * \retval Returns 0 on success, -1 on failure.
325  */
327  const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,
328  TxLogger TxLogFunc, TxLoggerCondition TxLogCondition,
329  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
330  ThreadExitPrintStatsFunc ThreadExitPrintStats)
331 {
332  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto,
333  TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
334  ThreadExitPrintStats);
335 }
336 
338  const char *parent_name, const char *name, const char *conf_name,
339  OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
340  TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit,
341  ThreadDeinitFunc ThreadDeinit,
342  ThreadExitPrintStatsFunc ThreadExitPrintStats)
343 {
344  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name, InitFunc,
345  alproto, TxLogFunc, -1, -1, TxLogCondition, ThreadInit, ThreadDeinit,
346  ThreadExitPrintStats);
347 }
348 
349 /**
350  * \brief Register a tx output module with progress.
351  *
352  * This function will register an output module so it can be
353  * configured with the configuration file.
354  *
355  * \retval Returns 0 on success, -1 on failure.
356  */
358  const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,
359  TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress,
360  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
361  ThreadExitPrintStatsFunc ThreadExitPrintStats)
362 {
363  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto,
364  TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
365  ThreadDeinit, ThreadExitPrintStats);
366 }
367 
368 void OutputRegisterTxSubModuleWithProgress(LoggerId id, const char *parent_name,
369  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
370  AppProto alproto, TxLogger TxLogFunc, int tc_log_progress,
371  int ts_log_progress, ThreadInitFunc ThreadInit,
372  ThreadDeinitFunc ThreadDeinit,
373  ThreadExitPrintStatsFunc ThreadExitPrintStats)
374 {
375  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name, InitFunc,
376  alproto, TxLogFunc, tc_log_progress, ts_log_progress, NULL, ThreadInit,
377  ThreadDeinit, ThreadExitPrintStats);
378 }
379 
380 /**
381  * \brief Register a tx output module.
382  *
383  * This function will register an output module so it can be
384  * configured with the configuration file.
385  *
386  * \retval Returns 0 on success, -1 on failure.
387  */
388 void OutputRegisterTxModule(LoggerId id, const char *name,
389  const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,
390  TxLogger TxLogFunc, ThreadInitFunc ThreadInit,
391  ThreadDeinitFunc ThreadDeinit,
392  ThreadExitPrintStatsFunc ThreadExitPrintStats)
393 {
394  OutputRegisterTxModuleWrapper(id, name, conf_name, InitFunc, alproto,
395  TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
396  ThreadExitPrintStats);
397 }
398 
399 void OutputRegisterTxSubModule(LoggerId id, const char *parent_name,
400  const char *name, const char *conf_name,
401  OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc,
402  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
403  ThreadExitPrintStatsFunc ThreadExitPrintStats)
404 {
405  OutputRegisterTxSubModuleWrapper(id, parent_name, name, conf_name,
406  InitFunc, alproto, TxLogFunc, -1, -1, NULL, ThreadInit, ThreadDeinit,
407  ThreadExitPrintStats);
408 }
409 
410 /**
411  * \brief Register a file output 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 OutputRegisterFileModule(LoggerId id, const char *name,
419  const char *conf_name, OutputInitFunc InitFunc, FileLogger FileLogFunc,
420  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
421  ThreadExitPrintStatsFunc ThreadExitPrintStats)
422 {
423  if (unlikely(FileLogFunc == NULL)) {
424  goto error;
425  }
426 
427  OutputModule *module = SCCalloc(1, sizeof(*module));
428  if (unlikely(module == NULL)) {
429  goto error;
430  }
431 
432  module->logger_id = id;
433  module->name = name;
434  module->conf_name = conf_name;
435  module->InitFunc = InitFunc;
436  module->FileLogFunc = FileLogFunc;
437  module->ThreadInit = ThreadInit;
438  module->ThreadDeinit = ThreadDeinit;
440  TAILQ_INSERT_TAIL(&output_modules, module, entries);
441 
442  SCLogDebug("File logger \"%s\" registered.", name);
443  return;
444 error:
445  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
446  exit(EXIT_FAILURE);
447 }
448 
449 /**
450  * \brief Register a file output sub-module.
451  *
452  * This function will register an output module so it can be
453  * configured with the configuration file.
454  *
455  * \retval Returns 0 on success, -1 on failure.
456  */
457 void OutputRegisterFileSubModule(LoggerId id, const char *parent_name,
458  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
459  FileLogger FileLogFunc, ThreadInitFunc ThreadInit,
460  ThreadDeinitFunc ThreadDeinit,
461  ThreadExitPrintStatsFunc ThreadExitPrintStats)
462 {
463  if (unlikely(FileLogFunc == NULL)) {
464  goto error;
465  }
466 
467  OutputModule *module = SCCalloc(1, sizeof(*module));
468  if (unlikely(module == NULL)) {
469  goto error;
470  }
471 
472  module->logger_id = id;
473  module->name = name;
474  module->conf_name = conf_name;
475  module->parent_name = parent_name;
476  module->InitSubFunc = InitFunc;
477  module->FileLogFunc = FileLogFunc;
478  module->ThreadInit = ThreadInit;
479  module->ThreadDeinit = ThreadDeinit;
481  TAILQ_INSERT_TAIL(&output_modules, module, entries);
482 
483  SCLogDebug("File logger \"%s\" registered.", name);
484  return;
485 error:
486  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
487  exit(EXIT_FAILURE);
488 }
489 
490 /**
491  * \brief Register a file data output module.
492  *
493  * This function will register an output module so it can be
494  * configured with the configuration file.
495  *
496  * \retval Returns 0 on success, -1 on failure.
497  */
498 void OutputRegisterFiledataModule(LoggerId id, const char *name,
499  const char *conf_name, OutputInitFunc InitFunc,
500  FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit,
501  ThreadDeinitFunc ThreadDeinit,
502  ThreadExitPrintStatsFunc ThreadExitPrintStats)
503 {
504  if (unlikely(FiledataLogFunc == NULL)) {
505  goto error;
506  }
507 
508  OutputModule *module = SCCalloc(1, sizeof(*module));
509  if (unlikely(module == NULL)) {
510  goto error;
511  }
512 
513  module->logger_id = id;
514  module->name = name;
515  module->conf_name = conf_name;
516  module->InitFunc = InitFunc;
517  module->FiledataLogFunc = FiledataLogFunc;
518  module->ThreadInit = ThreadInit;
519  module->ThreadDeinit = ThreadDeinit;
521  TAILQ_INSERT_TAIL(&output_modules, module, entries);
522 
523  SCLogDebug("Filedata logger \"%s\" registered.", name);
524  return;
525 error:
526  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
527  exit(EXIT_FAILURE);
528 }
529 
530 /**
531  * \brief Register a file data output sub-module.
532  *
533  * This function will register an output module so it can be
534  * configured with the configuration file.
535  *
536  * \retval Returns 0 on success, -1 on failure.
537  */
538 void OutputRegisterFiledataSubModule(LoggerId id, const char *parent_name,
539  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
540  FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit,
541  ThreadDeinitFunc ThreadDeinit,
542  ThreadExitPrintStatsFunc ThreadExitPrintStats)
543 {
544  if (unlikely(FiledataLogFunc == NULL)) {
545  goto error;
546  }
547 
548  OutputModule *module = SCCalloc(1, sizeof(*module));
549  if (unlikely(module == NULL)) {
550  goto error;
551  }
552 
553  module->logger_id = id;
554  module->name = name;
555  module->conf_name = conf_name;
556  module->parent_name = parent_name;
557  module->InitSubFunc = InitFunc;
558  module->FiledataLogFunc = FiledataLogFunc;
559  module->ThreadInit = ThreadInit;
560  module->ThreadDeinit = ThreadDeinit;
562  TAILQ_INSERT_TAIL(&output_modules, module, entries);
563 
564  SCLogDebug("Filedata logger \"%s\" registered.", name);
565  return;
566 error:
567  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
568  exit(EXIT_FAILURE);
569 }
570 
571 /**
572  * \brief Register a flow output module.
573  *
574  * This function will register an output module so it can be
575  * configured with the configuration file.
576  *
577  * \retval Returns 0 on success, -1 on failure.
578  */
579 void OutputRegisterFlowModule(LoggerId id, const char *name,
580  const char *conf_name, OutputInitFunc InitFunc, FlowLogger FlowLogFunc,
581  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
582  ThreadExitPrintStatsFunc ThreadExitPrintStats)
583 {
584  if (unlikely(FlowLogFunc == NULL)) {
585  goto error;
586  }
587 
588  OutputModule *module = SCCalloc(1, sizeof(*module));
589  if (unlikely(module == NULL)) {
590  goto error;
591  }
592 
593  module->logger_id = id;
594  module->name = name;
595  module->conf_name = conf_name;
596  module->InitFunc = InitFunc;
597  module->FlowLogFunc = FlowLogFunc;
598  module->ThreadInit = ThreadInit;
599  module->ThreadDeinit = ThreadDeinit;
601  TAILQ_INSERT_TAIL(&output_modules, module, entries);
602 
603  SCLogDebug("Flow logger \"%s\" registered.", name);
604  return;
605 error:
606  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
607  exit(EXIT_FAILURE);
608 }
609 
610 /**
611  * \brief Register a flow output sub-module.
612  *
613  * This function will register an output module so it can be
614  * configured with the configuration file.
615  *
616  * \retval Returns 0 on success, -1 on failure.
617  */
618 void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name,
619  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
620  FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit,
621  ThreadDeinitFunc ThreadDeinit,
622  ThreadExitPrintStatsFunc ThreadExitPrintStats)
623 {
624  if (unlikely(FlowLogFunc == NULL)) {
625  goto error;
626  }
627 
628  OutputModule *module = SCCalloc(1, sizeof(*module));
629  if (unlikely(module == NULL)) {
630  goto error;
631  }
632 
633  module->logger_id = id;
634  module->name = name;
635  module->conf_name = conf_name;
636  module->parent_name = parent_name;
637  module->InitSubFunc = InitFunc;
638  module->FlowLogFunc = FlowLogFunc;
639  module->ThreadInit = ThreadInit;
640  module->ThreadDeinit = ThreadDeinit;
642  TAILQ_INSERT_TAIL(&output_modules, module, entries);
643 
644  SCLogDebug("Flow logger \"%s\" registered.", name);
645  return;
646 error:
647  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
648  exit(EXIT_FAILURE);
649 }
650 
651 /**
652  * \brief Register a streaming data output module.
653  *
654  * This function will register an output module so it can be
655  * configured with the configuration file.
656  *
657  * \retval Returns 0 on success, -1 on failure.
658  */
659 void OutputRegisterStreamingModule(LoggerId id, const char *name,
660  const char *conf_name, OutputInitFunc InitFunc,
661  StreamingLogger StreamingLogFunc,
662  enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
663  ThreadDeinitFunc ThreadDeinit,
664  ThreadExitPrintStatsFunc ThreadExitPrintStats)
665 {
666  if (unlikely(StreamingLogFunc == NULL)) {
667  goto error;
668  }
669 
670  OutputModule *module = SCCalloc(1, sizeof(*module));
671  if (unlikely(module == NULL)) {
672  goto error;
673  }
674 
675  module->logger_id = id;
676  module->name = name;
677  module->conf_name = conf_name;
678  module->InitFunc = InitFunc;
679  module->StreamingLogFunc = StreamingLogFunc;
680  module->stream_type = stream_type;
681  module->ThreadInit = ThreadInit;
682  module->ThreadDeinit = ThreadDeinit;
684  TAILQ_INSERT_TAIL(&output_modules, module, entries);
685 
686  SCLogDebug("Streaming logger \"%s\" registered.", name);
687  return;
688 error:
689  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
690  exit(EXIT_FAILURE);
691 }
692 
693 /**
694  * \brief Register a streaming data output sub-module.
695  *
696  * This function will register an output module so it can be
697  * configured with the configuration file.
698  *
699  * \retval Returns 0 on success, -1 on failure.
700  */
701 void OutputRegisterStreamingSubModule(LoggerId id, const char *parent_name,
702  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
703  StreamingLogger StreamingLogFunc, enum OutputStreamingType stream_type,
704  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
705  ThreadExitPrintStatsFunc ThreadExitPrintStats)
706 {
707  if (unlikely(StreamingLogFunc == NULL)) {
708  goto error;
709  }
710 
711  OutputModule *module = SCCalloc(1, sizeof(*module));
712  if (unlikely(module == NULL)) {
713  goto error;
714  }
715 
716  module->logger_id = id;
717  module->name = name;
718  module->conf_name = conf_name;
719  module->parent_name = parent_name;
720  module->InitSubFunc = InitFunc;
721  module->StreamingLogFunc = StreamingLogFunc;
722  module->stream_type = stream_type;
723  module->ThreadInit = ThreadInit;
724  module->ThreadDeinit = ThreadDeinit;
726  TAILQ_INSERT_TAIL(&output_modules, module, entries);
727 
728  SCLogDebug("Streaming logger \"%s\" registered.", name);
729  return;
730 error:
731  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
732  exit(EXIT_FAILURE);
733 }
734 
735 /**
736  * \brief Register a stats data output module.
737  *
738  * This function will register an output module so it can be
739  * configured with the configuration file.
740  *
741  * \retval Returns 0 on success, -1 on failure.
742  */
743 void OutputRegisterStatsModule(LoggerId id, const char *name,
744  const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc,
745  ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
746  ThreadExitPrintStatsFunc ThreadExitPrintStats)
747 {
748  if (unlikely(StatsLogFunc == NULL)) {
749  goto error;
750  }
751 
752  OutputModule *module = SCCalloc(1, sizeof(*module));
753  if (unlikely(module == NULL)) {
754  goto error;
755  }
756 
757  module->logger_id = id;
758  module->name = name;
759  module->conf_name = conf_name;
760  module->InitFunc = InitFunc;
761  module->StatsLogFunc = StatsLogFunc;
762  module->ThreadInit = ThreadInit;
763  module->ThreadDeinit = ThreadDeinit;
765  TAILQ_INSERT_TAIL(&output_modules, module, entries);
766 
767  SCLogDebug("Stats logger \"%s\" registered.", name);
768  return;
769 error:
770  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
771  exit(EXIT_FAILURE);
772 }
773 
774 /**
775  * \brief Register a stats data output sub-module.
776  *
777  * This function will register an output module so it can be
778  * configured with the configuration file.
779  *
780  * \retval Returns 0 on success, -1 on failure.
781  */
782 void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
783  const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
784  StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
785  ThreadDeinitFunc ThreadDeinit,
786  ThreadExitPrintStatsFunc ThreadExitPrintStats)
787 {
788  if (unlikely(StatsLogFunc == NULL)) {
789  goto error;
790  }
791 
792  OutputModule *module = SCCalloc(1, sizeof(*module));
793  if (unlikely(module == NULL)) {
794  goto error;
795  }
796 
797  module->logger_id = id;
798  module->name = name;
799  module->conf_name = conf_name;
800  module->parent_name = parent_name;
801  module->InitSubFunc = InitFunc;
802  module->StatsLogFunc = StatsLogFunc;
803  module->ThreadInit = ThreadInit;
804  module->ThreadDeinit = ThreadDeinit;
806  TAILQ_INSERT_TAIL(&output_modules, module, entries);
807 
808  SCLogDebug("Stats logger \"%s\" registered.", name);
809  return;
810 error:
811  SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
812  exit(EXIT_FAILURE);
813 }
814 
815 /**
816  * \brief Get an output module by name.
817  *
818  * \retval The OutputModule with the given name or NULL if no output module
819  * with the given name is registered.
820  */
822 {
823  OutputModule *module;
824 
825  TAILQ_FOREACH(module, &output_modules, entries) {
826  if (strcmp(module->conf_name, conf_name) == 0)
827  return module;
828  }
829 
830  return NULL;
831 }
832 
833 /**
834  * \brief Deregister all modules. Useful for a memory clean exit.
835  */
837 {
838  OutputModule *module;
839 
840  while ((module = TAILQ_FIRST(&output_modules))) {
841  TAILQ_REMOVE(&output_modules, module, entries);
842  SCFree(module);
843  }
844 }
845 
846 static int drop_loggers = 0;
847 
849 {
850  if (drop_loggers)
851  return -1;
852  drop_loggers++;
853  return 0;
854 }
855 
857 {
858  if (drop_loggers)
859  drop_loggers--;
860 }
861 
862 /**
863  * \brief Register a flag for file rotation notification.
864  *
865  * \param flag A pointer that will be set to 1 when file rotation is
866  * requested.
867  */
869 {
870  OutputFileRolloverFlag *flag_entry = SCCalloc(1, sizeof(*flag_entry));
871  if (unlikely(flag_entry == NULL)) {
873  "Failed to allocate memory to register file rotation flag");
874  return;
875  }
876  flag_entry->flag = flag;
877  TAILQ_INSERT_TAIL(&output_file_rotation_flags, flag_entry, entries);
878 }
879 
880 /**
881  * \brief Unregister a file rotation flag.
882  *
883  * Note that it is safe to call this function with a flag that may not
884  * have been registered, in which case this function won't do
885  * anything.
886  *
887  * \param flag A pointer that has been previously registered for file
888  * rotation notifications.
889  */
891 {
892  OutputFileRolloverFlag *entry, *next;
893  for (entry = TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;
894  entry = next) {
895  next = TAILQ_NEXT(entry, entries);
896  if (entry->flag == flag) {
897  TAILQ_REMOVE(&output_file_rotation_flags, entry, entries);
898  SCFree(entry);
899  break;
900  }
901  }
902 }
903 
904 /**
905  * \brief Notifies all registered file rotation notification flags.
906  */
909  TAILQ_FOREACH(flag, &output_file_rotation_flags, entries) {
910  *(flag->flag) = 1;
911  }
912 }
913 
914 TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
915 {
916  LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
917  RootLogger *logger = TAILQ_FIRST(&RootLoggers);
918  LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);
919  while (logger && thread_store_node) {
920  if (logger->LogFunc != NULL) {
921  logger->LogFunc(tv, p, thread_store_node->thread_data);
922  }
923  logger = TAILQ_NEXT(logger, entries);
924  thread_store_node = TAILQ_NEXT(thread_store_node, entries);
925  }
926 
927  return TM_ECODE_OK;
928 }
929 
930 TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
931 {
932  LoggerThreadStore *thread_store = SCCalloc(1, sizeof(*thread_store));
933  if (thread_store == NULL) {
934  return TM_ECODE_FAILED;
935  }
936  TAILQ_INIT(thread_store);
937  *data = (void *)thread_store;
938 
939  RootLogger *logger;
940  TAILQ_FOREACH(logger, &RootLoggers, entries) {
941 
942  void *child_thread_data = NULL;
943  if (logger->ThreadInit != NULL) {
944  if (logger->ThreadInit(tv, initdata, &child_thread_data) == TM_ECODE_OK) {
945  LoggerThreadStoreNode *thread_store_node =
946  SCCalloc(1, sizeof(*thread_store_node));
947  if (thread_store_node == NULL) {
948  /* Undo everything, calling de-init will take care
949  * of that. */
950  OutputLoggerThreadDeinit(tv, thread_store);
951  return TM_ECODE_FAILED;
952  }
953  thread_store_node->thread_data = child_thread_data;
954  TAILQ_INSERT_TAIL(thread_store, thread_store_node, entries);
955  }
956  }
957  }
958  return TM_ECODE_OK;
959 }
960 
962 {
963  if (thread_data == NULL)
964  return TM_ECODE_FAILED;
965 
966  LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
967  RootLogger *logger = TAILQ_FIRST(&RootLoggers);
968  LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);
969  while (logger && thread_store_node) {
970  if (logger->ThreadDeinit != NULL) {
971  logger->ThreadDeinit(tv, thread_store_node->thread_data);
972  }
973  logger = TAILQ_NEXT(logger, entries);
974  thread_store_node = TAILQ_NEXT(thread_store_node, entries);
975  }
976 
977  /* Free the thread store. */
978  while ((thread_store_node = TAILQ_FIRST(thread_store)) != NULL) {
979  TAILQ_REMOVE(thread_store, thread_store_node, entries);
980  SCFree(thread_store_node);
981  }
982  SCFree(thread_store);
983 
984  return TM_ECODE_OK;
985 }
986 
987 void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data)
988 {
989  LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
990  RootLogger *logger = TAILQ_FIRST(&RootLoggers);
991  LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);
992  while (logger && thread_store_node) {
993  if (logger->ThreadExitPrintStats != NULL) {
994  logger->ThreadExitPrintStats(tv, thread_store_node->thread_data);
995  }
996  logger = TAILQ_NEXT(logger, entries);
997  thread_store_node = TAILQ_NEXT(thread_store_node, entries);
998  }
999 }
1000 
1002  ThreadDeinitFunc ThreadDeinit,
1003  ThreadExitPrintStatsFunc ThreadExitPrintStats,
1004  OutputLogFunc LogFunc)
1005 {
1006  RootLogger *logger = SCCalloc(1, sizeof(*logger));
1007  if (logger == NULL) {
1008  return;
1009  }
1010  logger->ThreadInit = ThreadInit;
1011  logger->ThreadDeinit = ThreadDeinit;
1013  logger->LogFunc = LogFunc;
1014  TAILQ_INSERT_TAIL(&RootLoggers, logger, entries);
1015 }
1016 
1018 {
1021 }
1022 
1023 /**
1024  * \brief Register all root loggers.
1025  */
1027 {
1033 }
1034 
1035 /**
1036  * \brief Register all non-root logging modules.
1037  */
1039 {
1040  /* custom format log*/
1042 
1043  LuaLogRegister();
1044  /* fast log */
1046  /* debug log */
1048  /* prelue log */
1050  /* syslog log */
1052  /* unified2 log */
1054  /* drop log */
1057  /* json log */
1059  /* email logs */
1061  /* http log */
1064  /* tls log */
1068  /* ssh */
1070  /* pcap log */
1071  PcapLogRegister();
1072  /* file log */
1076  /* dns */
1078  /* tcp streaming data */
1080  /* log stats */
1082 
1085  /* flow/netflow */
1088  /* json stats */
1090 
1091  /* DNP3. */
1094 
1095  /* NFS JSON logger. */
1097  /* TFTP JSON logger. */
1099  /* SMB JSON logger. */
1101  /* IKEv2 JSON logger. */
1103  /* KRB5 JSON logger. */
1105  /* DHCP JSON logger. */
1107  /* SNMP JSON logger. */
1109  /* Template JSON logger. */
1111  /* Template Rust JSON logger. */
1113 }
void JsonKRB5LogRegister(void)
void LogTlsStoreRegister(void)
Definition: log-tlsstore.c:413
void OutputJsonRegister(void)
Definition: output-json.c:77
void OutputFiledataLoggerRegister(void)
TmEcode(* OutputLogFunc)(ThreadVars *, Packet *, void *)
Definition: output.h:48
StreamingLogger StreamingLogFunc
Definition: output.h:69
void LogCustomFormatRegister(void)
TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
Definition: output.c:914
void JsonFlowLogRegister(void)
int ts_log_progress
Definition: output.h:74
ThreadDeinitFunc ThreadDeinit
Definition: output.c:86
OutputFileRolloverFlag
Definition: output.c:115
#define SCLogDebug(...)
Definition: util-debug.h:335
void PcapLogRegister(void)
Definition: log-pcap.c:205
#define TAILQ_FIRST(head)
Definition: queue.h:339
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:350
struct HtpBodyChunk_ * next
LoggerThreadStoreNode
Definition: output.c:99
void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a stats data output module.
Definition: output.c:743
void JsonTemplateRustLogRegister(void)
LoggerId
void LogDropLogRegister(void)
function to register the drop log module
Definition: log-droplog.c:494
void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a stats data output sub-module.
Definition: output.c:782
OutputInitFunc InitFunc
Definition: output.h:55
#define unlikely(expr)
Definition: util-optimize.h:35
void JsonTlsLogRegister(void)
ThreadDeinitFunc ThreadDeinit
Definition: output.h:59
PacketLogger PacketLogFunc
Definition: output.h:62
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
Definition: tm-modules.h:41
void OutputFilestoreRegister(void)
void JsonIKEv2LogRegister(void)
void OutputRegisterFiledataSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file data output sub-module.
Definition: output.c:538
void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data)
Definition: output.c:987
void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, StreamingLogger StreamingLogFunc, enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a streaming data output module.
Definition: output.c:659
OutputLogFunc LogFunc
Definition: output.c:88
int tc_log_progress
Definition: output.h:73
int OutputDropLoggerEnable(void)
Definition: output.c:848
OutputInitSubFunc InitSubFunc
Definition: output.h:56
void AlertFastLogRegister(void)
Definition: alert-fastlog.c:78
void AlertSyslogRegister(void)
Function to register the AlertSyslog module.
Definition: alert-syslog.c:395
uint16_t AppProto
int(* StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *)
Definition: output-stats.h:47
void JsonSshLogRegister(void)
OutputStreamingType
typedef TAILQ_HEAD(LoggerThreadStore_, LoggerThreadStoreNode_)
Definition: output.c:101
LoggerId logger_id
Definition: output.h:51
void OutputRegisterRootLoggers(void)
Register all root loggers.
Definition: output.c:1026
OutputInitResult(* OutputInitSubFunc)(ConfNode *, OutputCtx *)
Definition: output.h:47
ThreadInitFunc ThreadInit
Definition: output.h:58
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
Definition: output.c:821
void JsonDnsLogRegister(void)
void OutputRegisterFlowModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a flow output module.
Definition: output.c:579
void OutputRegisterLoggers(void)
Register all non-root logging modules.
Definition: output.c:1038
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:40
void JsonNetFlowLogRegister(void)
TxLoggerCondition TxLogCondition
Definition: output.h:65
void AlertPreludeRegister(void)
#define SCCalloc(nm, a)
Definition: util-mem.h:197
void LogFilestoreRegister(void)
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output module.
Definition: output.c:160
void OutputRegisterFileRotationFlag(int *flag)
Register a flag for file rotation notification.
Definition: output.c:868
void OutputRegisterFileSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file output sub-module.
Definition: output.c:457
int(* FlowLogger)(ThreadVars *, void *thread_data, Flow *f)
Definition: output-flow.h:32
int(* PacketLogger)(ThreadVars *, void *thread_data, const Packet *)
Definition: output-packet.h:33
void JsonStatsLogRegister(void)
void JsonSMBLogRegister(void)
TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
Definition: output.c:930
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output sub-module.
Definition: output.c:201
#define TAILQ_INIT(head)
Definition: queue.h:370
TxLogger TxLogFunc
Definition: output.h:64
ThreadInitFunc ThreadInit
Definition: output.c:85
void JsonAnomalyLogRegister(void)
AppProto alproto
Definition: output.h:71
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:294
void LuaLogRegister(void)
Definition: output-lua.c:959
OutputInitResult(* OutputInitFunc)(ConfNode *)
Definition: output.h:46
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, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module with progress.
Definition: output.c:357
const char * name
Definition: output.h:52
void JsonDHCPLogRegister(void)
enum OutputStreamingType stream_type
Definition: output.h:72
int(* TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id)
Definition: output-tx.h:32
void OutputUnregisterFileRotationFlag(int *flag)
Unregister a file rotation flag.
Definition: output.c:890
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:412
void JsonTemplateLogRegister(void)
void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc)
Definition: output.c:1001
void TmModuleLoggerRegister(void)
Definition: output.c:1017
void LogHttpLogRegister(void)
Definition: log-httplog.c:66
void JsonDropLogRegister(void)
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, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output.c:368
TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data)
Definition: output.c:961
void OutputTxLoggerRegister(void)
Definition: output-tx.c:366
void LogTcpDataLogRegister(void)
Definition: log-tcp-data.c:62
int(* FiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
void OutputRegisterFileModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file output module.
Definition: output.c:418
FlowLogger FlowLogFunc
Definition: output.h:68
void JsonAlertLogRegister(void)
void OutputDeregisterAll(void)
Deregister all modules. Useful for a memory clean exit.
Definition: output.c:836
void Unified2AlertRegister(void)
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, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output.c:399
void OutputStreamingLoggerRegister(void)
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:385
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, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output.c:337
int(* StreamingLogger)(ThreadVars *, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
void JsonHttpLogRegister(void)
ThreadExitPrintStatsFunc ThreadExitPrintStats
Definition: output.h:60
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a flow output sub-module.
Definition: output.c:618
FiledataLogger FiledataLogFunc
Definition: output.h:67
ThreadExitPrintStatsFunc ThreadExitPrintStats
Definition: output.c:87
void OutputPacketLoggerRegister(void)
#define SCFree(a)
Definition: util-mem.h:228
#define TAILQ_ENTRY(type)
Definition: queue.h:330
const char * parent_name
Definition: output.h:54
void OutputRegisterFiledataModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file data output module.
Definition: output.c:498
int(* FileLogger)(ThreadVars *, void *thread_data, const Packet *, const File *, uint8_t direction)
Definition: output-file.h:33
void JsonSNMPLogRegister(void)
void OutputDropLoggerDisable(void)
Definition: output.c:856
OutputModuleList output_modules
void LogStatsLogRegister(void)
Definition: log-stats.c:290
void OutputRegisterTxModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module.
Definition: output.c:388
FileLogger FileLogFunc
Definition: output.h:66
int(* TxLoggerCondition)(ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id)
Definition: output-tx.h:37
void JsonFileLogRegister(void)
void AlertDebugLogRegister(void)
void JsonSmtpLogRegister(void)
const char * conf_name
Definition: output.h:53
void JsonMetadataLogRegister(void)
void OutputRegisterStreamingSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StreamingLogger StreamingLogFunc, enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a streaming data output sub-module.
Definition: output.c:701
void JsonDNP3LogRegister(void)
StatsLogger StatsLogFunc
Definition: output.h:70
void JsonTFTPLogRegister(void)
#define TAILQ_NEXT(elm, field)
Definition: queue.h:341
void OutputFileLoggerRegister(void)
Definition: output-file.c:271
PacketLogCondition PacketConditionFunc
Definition: output.h:63
int(* PacketLogCondition)(ThreadVars *, const Packet *)
Definition: output-packet.h:38
Per thread variable structure.
Definition: threadvars.h:57
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:39
void OutputRegisterTxModuleWithCondition(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, TxLoggerCondition TxLogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a tx output module with condition.
Definition: output.c:326
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:327
void JsonNFSLogRegister(void)
void LogTlsLogRegister(void)
Definition: log-tlslog.c:500
void OutputRegisterModule(const char *, const char *, OutputInitFunc)
void OutputNotifyFileRotation(void)
Notifies all registered file rotation notification flags.
Definition: output.c:907