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