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