]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
examples: add tx logger to custom logger example
authorJason Ish <jason.ish@oisf.net>
Thu, 29 Aug 2024 22:33:03 +0000 (16:33 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
However, its disabled due to issue
https://redmine.openinfosecfoundation.org/issues/7236.

Ticket: #7227

examples/plugins/c-custom-loggers/custom-logger.c

index fbebbd5e987074754c516da9847f289d4baeddf3..d533b8830dec28b46708c4ecd94f43e6576d3a0b 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "output-packet.h"
 #include "output-flow.h"
+#include "output-tx.h"
 #include "util-print.h"
 
 static int CustomPacketLogger(ThreadVars *tv, void *thread_data, const Packet *p)
@@ -78,6 +79,15 @@ static int CustomFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
     return 0;
 }
 
+#if 0
+static int CustomDnsLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state,
+        void *tx, uint64_t tx_id)
+{
+    SCLogNotice("We have a DNS transaction");
+    return 0;
+}
+#endif
+
 static TmEcode ThreadInit(ThreadVars *tv, const void *initdata, void **data)
 {
     return TM_ECODE_OK;
@@ -96,6 +106,15 @@ static void Init(void)
             CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
     SCOutputRegisterFlowLogger(
             "custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
+
+    /* Register a custom DNS transaction logger.
+     *
+     * Currently disabled due to https://redmine.openinfosecfoundation.org/issues/7236.
+     */
+#if 0
+    OutputRegisterTxLogger(LOGGER_USER, "custom-dns-logger", ALPROTO_DNS, CustomDnsLogger, NULL, -1,
+            -1, NULL, ThreadInit, ThreadDeinit);
+#endif
 }
 
 const SCPlugin PluginRegistration = {