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