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