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