]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: generic simple tx json logger
authorPhilippe Antoine <contact@catenacyber.fr>
Sun, 14 May 2023 18:03:02 +0000 (20:03 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 13 Apr 2024 06:50:18 +0000 (08:50 +0200)
Ticket: 3827

45 files changed:
rust/src/applayer.rs
rust/src/applayertemplate/template.rs
rust/src/bittorrent_dht/bittorrent_dht.rs
rust/src/http2/http2.rs
rust/src/krb/krb5.rs
rust/src/modbus/modbus.rs
rust/src/quic/quic.rs
rust/src/rdp/rdp.rs
rust/src/rfb/rfb.rs
rust/src/sip/sip.rs
rust/src/snmp/snmp.rs
rust/src/ssh/ssh.rs
scripts/setup-app-layer.py
src/Makefile.am
src/app-layer-ftp.c
src/app-layer-tftp.c
src/output-json-alert.c
src/output-json-bittorrent-dht.c [deleted file]
src/output-json-bittorrent-dht.h [deleted file]
src/output-json-file.c
src/output-json-ftp.c
src/output-json-ftp.h
src/output-json-http2.c [deleted file]
src/output-json-http2.h [deleted file]
src/output-json-krb5.c [deleted file]
src/output-json-krb5.h [deleted file]
src/output-json-modbus.c [deleted file]
src/output-json-modbus.h [deleted file]
src/output-json-quic.c [deleted file]
src/output-json-quic.h [deleted file]
src/output-json-rdp.c [deleted file]
src/output-json-rdp.h [deleted file]
src/output-json-rfb.c [deleted file]
src/output-json-rfb.h [deleted file]
src/output-json-sip.c [deleted file]
src/output-json-sip.h [deleted file]
src/output-json-snmp.c [deleted file]
src/output-json-snmp.h [deleted file]
src/output-json-ssh.c [deleted file]
src/output-json-ssh.h [deleted file]
src/output-json-template.c [deleted file]
src/output-json-template.h [deleted file]
src/output-json-tftp.c [deleted file]
src/output-json-tftp.h [deleted file]
src/output.c

index 97db321e2249a8eeb1473d7190552d8642cac24a..522143fb6d0e2bcad097aeb2dd144615dbf4759c 100644 (file)
@@ -487,6 +487,7 @@ extern {
     pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16;
     pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
+    pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto);
 }
 
 #[repr(C)]
index dbbc7841fad54fe971aca2ed1b269970ff3169f0..e8cdc27dfe912596f3f9348b6184c11aab9b2f3f 100644 (file)
@@ -447,6 +447,7 @@ pub unsafe extern "C" fn rs_template_register_parser() {
                 SCLogError!("Invalid value for template.max-tx");
             }
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
         SCLogNotice!("Rust template parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for TEMPLATE.");
index 8c6857dc5d922dc813cd3ac82da04ef824da2d96..61eefb9e29af792d529be8c8262aa6640163c412 100644 (file)
@@ -318,6 +318,7 @@ pub unsafe extern "C" fn rs_bittorrent_dht_udp_register_parser() {
         {
             SCLogDebug!("Failed to register protocol detection pattern for direction TOCLIENT");
         }
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_BITTORRENT_DHT);
 
         SCLogDebug!("Parser registered for bittorrent-dht.");
     } else {
index b62ccb985034204244ec3fcca2128063d7d084bc..1a45881949c6230c9c8e0fb083de335971ba9daf 100644 (file)
@@ -1401,6 +1401,7 @@ pub unsafe extern "C" fn rs_http2_register_parser() {
                 SCLogError!("Invalid value for http2.max-reassembly-size");
             }
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP2);
         SCLogDebug!("Rust http2 parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for HTTP2.");
index 3f9ea23634c44cf6a97aaf1bb7e8734450e33d69..ddcca94b291c7b7ee6e6a887025db9fe636964ef 100644 (file)
@@ -28,7 +28,7 @@ use kerberos_parser::krb5::{EncryptionType,ErrorCode,MessageType,PrincipalName,R
 use asn1_rs::FromDer;
 use crate::applayer::{self, *};
 use crate::core;
-use crate::core::{AppProto,Flow,ALPROTO_FAILED,ALPROTO_UNKNOWN,Direction};
+use crate::core::{AppProto,Flow,ALPROTO_FAILED,ALPROTO_UNKNOWN,Direction, IPPROTO_TCP, IPPROTO_UDP};
 
 #[derive(AppLayerEvent)]
 pub enum KRB5Event {
@@ -616,6 +616,7 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_KRB5);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for KRB5/UDP.");
     }
@@ -633,6 +634,7 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_KRB5);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for KRB5/TCP.");
     }
index 246e9cae6d6cd9e3eb7a8418d9cbefadf2747433..1c0ecc884dd57eef9d2a2577fcd5e128d390c4dc 100644 (file)
@@ -416,6 +416,7 @@ pub unsafe extern "C" fn rs_modbus_register_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MODBUS);
     }
 }
 
index 8e3ea6f35a21b1742da793cecb3aa547de99ef38..8fb4c9a2f583b940541cbc42a1cd4ad9ff158ac8 100644 (file)
@@ -496,6 +496,7 @@ pub unsafe extern "C" fn rs_quic_register_parser() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust quic parser registered.");
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_QUIC);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for quic.");
     }
index f08026a82db8c359d4f8bbc4b5e6e4e00ea7d41c..2899f99c182400c428bec9f99f26032f60641002 100644 (file)
@@ -506,6 +506,7 @@ pub unsafe extern "C" fn rs_rdp_register_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RDP);
     }
 }
 
index 8c3381345012077a431c0d0853bff3733f9dc214..058ec53f6695d490a39b55751a6fc9b7e20d9ab6 100644 (file)
@@ -864,6 +864,7 @@ pub unsafe extern "C" fn rs_rfb_register_parser() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust rfb parser registered.");
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RFB);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for RFB.");
     }
index 75982216f2e039a7464c49a2cb14251831381154..e34783fe742a0372ce30ac43d633d683ba41965f 100755 (executable)
@@ -19,7 +19,7 @@
 
 use crate::applayer::{self, *};
 use crate::core;
-use crate::core::{AppProto, ALPROTO_UNKNOWN};
+use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_TCP, IPPROTO_UDP};
 use crate::frames::*;
 use crate::sip::parser::*;
 use nom7::Err;
@@ -569,6 +569,7 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
         if register_pattern_probe(core::IPPROTO_UDP) < 0 {
             return;
         }
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SIP);
     } else {
         SCLogDebug!("Protocol detection and parsing disabled for UDP SIP.");
     }
@@ -590,6 +591,7 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
         if register_pattern_probe(core::IPPROTO_TCP) < 0 {
             return;
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SIP);
     } else {
         SCLogDebug!("Protocol detection and parsing disabled for TCP SIP.");
     }
index a4481f4bc191f487d961864c1272d3b7ab91cf01..3b78b47f7a1d957a7ee4700e866e7fd1f8fb47d5 100644 (file)
@@ -423,6 +423,7 @@ pub unsafe extern "C" fn rs_register_snmp_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SNMP);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for SNMP.");
     }
index a0586894f9fb8efe352dc3e67cd27f3a55098ccb..c1f08a904c4da81faf9ca2ae4f50d3d1fbd7f408 100644 (file)
@@ -477,6 +477,7 @@ pub unsafe extern "C" fn rs_ssh_register_parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
         SCLogDebug!("Rust ssh parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for SSH.");
index d8426634bca8b34095bce28fb7da455aeab5c16d..26d9892b87f704fdb3e7883f33e5db8df5b21195 100755 (executable)
@@ -200,15 +200,21 @@ def logger_patch_output_c(proto):
     output = io.StringIO()
     inlines = open(filename).readlines()
     for i, line in enumerate(inlines):
-        if line.find("ALPROTO_TEMPLATE") > -1:
-            new_line = line.replace("TEMPLATE", proto.upper()).replace(
-                    "template", proto.lower())
-            output.write(new_line)
-        if line.find("output-json-template.h") > -1:
-            output.write(line.replace("template", proto.lower()))
         if line.find("/* Template JSON logger.") > -1:
             output.write(inlines[i].replace("Template", proto))
             output.write(inlines[i+1].replace("Template", proto))
+            output.write(inlines[i+2].replace("TEMPLATE", proto.upper()).replace(
+                    "template", proto.lower()).replace("Template", proto))
+            output.write(inlines[i+3])
+        if line.find("rs_template_logger_log") > -1:
+            output.write(inlines[i].replace("TEMPLATE", proto.upper()).replace(
+                    "template", proto.lower()))
+        if line.find("OutputTemplateLogInitSub(") > -1:
+            output.write(inlines[i].replace("Template", proto))
+            output.write(inlines[i+1])
+            output.write(inlines[i+2].replace("TEMPLATE", proto.upper()))
+            output.write(inlines[i+3])
+            output.write(inlines[i+4])
         output.write(line)
     open(filename, "w").write(output.getvalue())
 
@@ -216,27 +222,12 @@ def logger_copy_templates(proto):
     lower = proto.lower()
     
     pairs = (
-        ("src/output-json-template.h",
-         "src/output-json-%s.h" % (lower)),
-        ("src/output-json-template.c",
-         "src/output-json-%s.c" % (lower)),
         ("rust/src/applayertemplate/logger.rs",
          "rust/src/applayer%s/logger.rs" % (lower)),
     )
 
     common_copy_templates(proto, pairs)
 
-def logger_patch_makefile_am(protoname):
-    filename = "src/Makefile.am"
-    print("Patching %s." % (filename))
-    output = io.StringIO()
-    with open(filename) as infile:
-        for line in infile:
-            if line.lstrip().startswith("output-json-template."):
-                output.write(line.replace("template", protoname.lower()))
-            output.write(line)
-    open(filename, "w").write(output.getvalue())
-
 
 def detect_copy_templates(proto, buffername):
     lower = proto.lower()
@@ -398,7 +389,6 @@ def main():
             raise SetupError("no app-layer parser exists for %s" % (proto))
         logger_copy_templates(proto)
         patch_rust_applayer_mod_rs(proto)
-        logger_patch_makefile_am(proto)
         logger_patch_output_c(proto)
         logger_patch_suricata_yaml_in(proto)
 
index 6d22b80ff1f09bdc2f7a2d79bacc82931a98bdd3..b19e34dc4da1bb176da4979c57f909c4ad1444b1 100755 (executable)
@@ -403,7 +403,6 @@ noinst_HEADERS = \
        output.h \
        output-json-alert.h \
        output-json-anomaly.h \
-       output-json-bittorrent-dht.h \
        output-json-dcerpc.h \
        output-json-dhcp.h \
        output-json-dnp3.h \
@@ -416,27 +415,16 @@ noinst_HEADERS = \
        output-json-frame.h \
        output-json-ftp.h \
        output-json.h \
-       output-json-http2.h \
        output-json-http.h \
        output-json-ike.h \
-       output-json-krb5.h \
        output-json-metadata.h \
-       output-json-modbus.h \
-       output-json-quic.h \
        output-json-mqtt.h \
        output-json-netflow.h \
        output-json-nfs.h \
        output-json-pgsql.h \
-       output-json-rdp.h \
-       output-json-rfb.h \
-       output-json-sip.h \
        output-json-smb.h \
        output-json-smtp.h \
-       output-json-snmp.h \
-       output-json-ssh.h \
        output-json-stats.h \
-       output-json-template.h \
-       output-json-tftp.h \
        output-json-tls.h \
        output-eve-syslog.h \
        output-lua.h \
@@ -1025,7 +1013,6 @@ libsuricata_c_a_SOURCES = \
        output-flow.c \
        output-json-alert.c \
        output-json-anomaly.c \
-       output-json-bittorrent-dht.c \
        output-json.c \
        output-json-common.c \
        output-json-dcerpc.c \
@@ -1039,27 +1026,16 @@ libsuricata_c_a_SOURCES = \
        output-json-flow.c \
        output-json-frame.c \
        output-json-ftp.c \
-       output-json-http2.c \
        output-json-http.c \
        output-json-ike.c \
-       output-json-krb5.c \
        output-json-metadata.c \
-       output-json-modbus.c \
-       output-json-quic.c \
        output-json-mqtt.c \
        output-json-netflow.c \
        output-json-nfs.c \
        output-json-pgsql.c \
-       output-json-rdp.c \
-       output-json-rfb.c \
-       output-json-sip.c \
        output-json-smb.c \
        output-json-smtp.c \
-       output-json-snmp.c \
-       output-json-ssh.c \
        output-json-stats.c \
-       output-json-template.c \
-       output-json-tftp.c \
        output-json-tls.c \
        output-eve.c \
        output-eve-syslog.c \
index c1e8b1646e9011f42f3ec657279268c0cb687a4b..2971996fad763f66b8f273c359fd3fe2e009b50b 100644 (file)
@@ -1348,6 +1348,9 @@ void RegisterFTPParsers(void)
         AppLayerParserRegisterGetEventInfo(IPPROTO_TCP, ALPROTO_FTP, ftp_get_event_info);
         AppLayerParserRegisterGetEventInfoById(IPPROTO_TCP, ALPROTO_FTP, ftp_get_event_info_by_id);
 
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTP);
+        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTPDATA);
+
         sbcfg.buf_size = 4096;
         sbcfg.Calloc = FTPCalloc;
         sbcfg.Realloc = FTPRealloc;
index 73dc52a59eac609ba04e8ec66c5156c595131386..0c08c6d5897987266f101fc1ca7193b123c7ec50 100644 (file)
@@ -190,6 +190,7 @@ void RegisterTFTPParsers(void)
                                               TFTPProbingParser);
             }
         }
+        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_TFTP);
     } else {
         SCLogDebug("Protocol detector and parser disabled for TFTP.");
         return;
index 18a14a0fc5051efc20e2abb3ea80a34c984c992e..8465e2a566c92b0005ad656a1f6b48be9a87465a 100644 (file)
 #include "output-json-nfs.h"
 #include "output-json-smb.h"
 #include "output-json-flow.h"
-#include "output-json-sip.h"
-#include "output-json-rfb.h"
 #include "output-json-mqtt.h"
 #include "output-json-ike.h"
-#include "output-json-modbus.h"
 #include "output-json-frame.h"
-#include "output-json-quic.h"
 
 #include "util-print.h"
 #include "util-optimize.h"
diff --git a/src/output-json-bittorrent-dht.c b/src/output-json-bittorrent-dht.c
deleted file mode 100644 (file)
index 066df78..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (C) 2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * Implement JSON/eve logging app-layer BitTorrent DHT.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "output-json-bittorrent-dht.h"
-#include "rust.h"
-
-typedef struct LogBitTorrentDHTFileCtx_ {
-    uint32_t flags;
-    OutputJsonCtx *eve_ctx;
-} LogBitTorrentDHTFileCtx;
-
-typedef struct LogBitTorrentDHTLogThread_ {
-    LogBitTorrentDHTFileCtx *bittorrent_dht_log_ctx;
-    OutputJsonThreadCtx *ctx;
-} LogBitTorrentDHTLogThread;
-
-static int JsonBitTorrentDHTLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
-        void *state, void *tx, uint64_t tx_id)
-{
-    LogBitTorrentDHTLogThread *thread = thread_data;
-
-    JsonBuilder *js = CreateEveHeader(
-            p, LOG_DIR_PACKET, "bittorrent_dht", NULL, thread->bittorrent_dht_log_ctx->eve_ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (!rs_bittorrent_dht_logger_log(tx, js)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(js, thread->ctx);
-    jb_free(js);
-
-    return TM_ECODE_OK;
-
-error:
-    jb_free(js);
-    return TM_ECODE_FAILED;
-}
-
-static void OutputBitTorrentDHTLogDeInitCtxSub(OutputCtx *output_ctx)
-{
-    LogBitTorrentDHTFileCtx *bittorrent_dht_log_ctx = (LogBitTorrentDHTFileCtx *)output_ctx->data;
-    SCFree(bittorrent_dht_log_ctx);
-    SCFree(output_ctx);
-}
-
-static OutputInitResult OutputBitTorrentDHTLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    OutputInitResult result = { NULL, false };
-    OutputJsonCtx *ajt = parent_ctx->data;
-
-    LogBitTorrentDHTFileCtx *bittorrent_dht_log_ctx = SCCalloc(1, sizeof(*bittorrent_dht_log_ctx));
-    if (unlikely(bittorrent_dht_log_ctx == NULL)) {
-        return result;
-    }
-    bittorrent_dht_log_ctx->eve_ctx = ajt;
-
-    OutputCtx *output_ctx = SCCalloc(1, sizeof(*output_ctx));
-    if (unlikely(output_ctx == NULL)) {
-        SCFree(bittorrent_dht_log_ctx);
-        return result;
-    }
-    output_ctx->data = bittorrent_dht_log_ctx;
-    output_ctx->DeInit = OutputBitTorrentDHTLogDeInitCtxSub;
-
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_BITTORRENT_DHT);
-
-    result.ctx = output_ctx;
-    result.ok = true;
-    return result;
-}
-
-static TmEcode JsonBitTorrentDHTLogThreadInit(ThreadVars *t, const void *initdata, void **data)
-{
-    LogBitTorrentDHTLogThread *thread = SCCalloc(1, sizeof(*thread));
-    if (unlikely(thread == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (initdata == NULL) {
-        SCLogDebug("Error getting context for EveLogBitTorrentDHT.  \"initdata\" is NULL.");
-        goto error_exit;
-    }
-
-    thread->bittorrent_dht_log_ctx = ((OutputCtx *)initdata)->data;
-    thread->ctx = CreateEveThreadCtx(t, thread->bittorrent_dht_log_ctx->eve_ctx);
-    if (!thread->ctx) {
-        goto error_exit;
-    }
-    *data = (void *)thread;
-
-    return TM_ECODE_OK;
-
-error_exit:
-    SCFree(thread);
-    return TM_ECODE_FAILED;
-}
-
-static TmEcode JsonBitTorrentDHTLogThreadDeinit(ThreadVars *t, void *data)
-{
-    LogBitTorrentDHTLogThread *thread = (LogBitTorrentDHTLogThread *)data;
-    if (thread == NULL) {
-        return TM_ECODE_OK;
-    }
-    FreeEveThreadCtx(thread->ctx);
-    SCFree(thread);
-    return TM_ECODE_OK;
-}
-
-void JsonBitTorrentDHTLogRegister(void)
-{
-    if (ConfGetNode("app-layer.protocols.bittorrent-dht") == NULL) {
-        return;
-    }
-
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonBitTorrentDHTLog",
-            "eve-log.bittorrent-dht", OutputBitTorrentDHTLogInitSub, ALPROTO_BITTORRENT_DHT,
-            JsonBitTorrentDHTLogger, JsonBitTorrentDHTLogThreadInit,
-            JsonBitTorrentDHTLogThreadDeinit, NULL);
-}
diff --git a/src/output-json-bittorrent-dht.h b/src/output-json-bittorrent-dht.h
deleted file mode 100644 (file)
index 9396f5a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- */
-
-#ifndef SURICATA_OUTPUT_JSON_BITTORRENT_DHT_H
-#define SURICATA_OUTPUT_JSON_BITTORRENT_DHT_H
-
-void JsonBitTorrentDHTLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_BITTORRENT_DHT_H */
index 1018be06ee80f759b16cca5683a413505d77edc2..ae8400a18d536ade1c735926f4e32cd7050744d8 100644 (file)
@@ -61,7 +61,6 @@
 #include "output-json-email-common.h"
 #include "output-json-nfs.h"
 #include "output-json-smb.h"
-#include "output-json-http2.h"
 
 #include "app-layer-htp.h"
 #include "app-layer-htp-xff.h"
index 34422f72f4af19210b40de9a639f0f31e0b32af7..14232bdfe3937ee6eb727e78cd6890be68d09bac 100644 (file)
@@ -154,60 +154,3 @@ bool EveFTPLogCommand(void *vtx, JsonBuilder *jb)
     jb_close(jb);
     return true;
 }
-
-
-static int JsonFTPLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *vtx, uint64_t tx_id)
-{
-    SCEnter();
-    OutputJsonThreadCtx *thread = thread_data;
-
-    const char *event_type;
-    if (f->alproto == ALPROTO_FTPDATA) {
-        event_type = "ftp_data";
-    } else {
-        event_type = "ftp";
-    }
-
-    JsonBuilder *jb =
-            CreateEveHeaderWithTxId(p, LOG_DIR_FLOW, event_type, NULL, tx_id, thread->ctx);
-    if (likely(jb)) {
-        if (f->alproto == ALPROTO_FTPDATA) {
-            if (!EveFTPDataAddMetadata(vtx, jb)) {
-                goto fail;
-            }
-        } else {
-            EveFTPLogCommand(vtx, jb);
-        }
-
-        OutputJsonBuilderBuffer(jb, thread);
-
-        jb_free(jb);
-    }
-    return TM_ECODE_OK;
-
-fail:
-    jb_free(jb);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputFTPLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTP);
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTPDATA);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonFTPLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
-            OutputFTPLogInitSub, ALPROTO_FTP, JsonFTPLogger, JsonLogThreadInit, JsonLogThreadDeinit,
-            NULL);
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
-            OutputFTPLogInitSub, ALPROTO_FTPDATA, JsonFTPLogger, JsonLogThreadInit,
-            JsonLogThreadDeinit, NULL);
-
-    SCLogDebug("FTP JSON logger registered.");
-}
index b87eebe2cc3f9f7b84f296f33c4e1d3a3d819917..57c35e9b66cb3016f32c96082737639636a4c658 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef SURICATA_OUTPUT_JSON_FTP_H
 #define SURICATA_OUTPUT_JSON_FTP_H
 
-void JsonFTPLogRegister(void);
 bool EveFTPLogCommand(void *vtx, JsonBuilder *js);
 
 #endif /* SURICATA_OUTPUT_JSON_FTP_H */
diff --git a/src/output-json-http2.c b/src/output-json-http2.c
deleted file mode 100644 (file)
index cb096f3..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright (C) 2020-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Philippe Antoine <p.antoine@catenacyber.fr>
- *
- * Implements HTTP2 JSON logging portion of the engine.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-print.h"
-#include "util-unittest.h"
-
-#include "util-debug.h"
-#include "app-layer-parser.h"
-#include "output.h"
-#include "app-layer-http2.h"
-#include "app-layer.h"
-#include "util-privs.h"
-#include "util-buffer.h"
-
-#include "util-logopenfile.h"
-
-#include "output-json.h"
-#include "output-json-http2.h"
-#include "rust.h"
-
-#define MODULE_NAME "LogHttp2Log"
-
-typedef struct OutputHttp2Ctx_ {
-    OutputJsonCtx *eve_ctx;
-} OutputHttp2Ctx;
-
-
-typedef struct JsonHttp2LogThread_ {
-    OutputHttp2Ctx *http2log_ctx;
-    OutputJsonThreadCtx *ctx;
-} JsonHttp2LogThread;
-
-static int JsonHttp2Logger(ThreadVars *tv, void *thread_data, const Packet *p,
-                         Flow *f, void *state, void *txptr, uint64_t tx_id)
-{
-    JsonHttp2LogThread *aft = (JsonHttp2LogThread *)thread_data;
-
-    if (unlikely(state == NULL)) {
-        return 0;
-    }
-
-    JsonBuilder *js = CreateEveHeaderWithTxId(
-            p, LOG_DIR_FLOW, "http", NULL, tx_id, aft->http2log_ctx->eve_ctx);
-    if (unlikely(js == NULL))
-        return 0;
-
-    if (!rs_http2_log_json(txptr, js)) {
-        goto end;
-    }
-    OutputJsonBuilderBuffer(js, aft->ctx);
-end:
-    jb_free(js);
-    return 0;
-}
-
-static TmEcode JsonHttp2LogThreadInit(ThreadVars *t, const void *initdata, void **data)
-{
-    JsonHttp2LogThread *aft = SCCalloc(1, sizeof(JsonHttp2LogThread));
-    if (unlikely(aft == NULL))
-        return TM_ECODE_FAILED;
-
-    if(initdata == NULL)
-    {
-        SCLogDebug("Error getting context for EveLogHTTP2.  \"initdata\" argument NULL");
-        goto error_exit;
-    }
-
-    /* Use the Output Context (file pointer and mutex) */
-    aft->http2log_ctx = ((OutputCtx *)initdata)->data;
-    aft->ctx = CreateEveThreadCtx(t, aft->http2log_ctx->eve_ctx);
-    if (!aft->ctx) {
-        goto error_exit;
-    }
-
-    *data = (void *)aft;
-    return TM_ECODE_OK;
-
-error_exit:
-    SCFree(aft);
-    return TM_ECODE_FAILED;
-}
-
-static TmEcode JsonHttp2LogThreadDeinit(ThreadVars *t, void *data)
-{
-    JsonHttp2LogThread *aft = (JsonHttp2LogThread *)data;
-    if (aft == NULL) {
-        return TM_ECODE_OK;
-    }
-
-    FreeEveThreadCtx(aft->ctx);
-    /* clear memory */
-    memset(aft, 0, sizeof(JsonHttp2LogThread));
-
-    SCFree(aft);
-    return TM_ECODE_OK;
-}
-
-static void OutputHttp2LogDeinitSub(OutputCtx *output_ctx)
-{
-    OutputHttp2Ctx *http2_ctx = output_ctx->data;
-    SCFree(http2_ctx);
-    SCFree(output_ctx);
-}
-
-static OutputInitResult OutputHttp2LogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    OutputInitResult result = { NULL, false };
-    OutputJsonCtx *ojc = parent_ctx->data;
-
-    OutputHttp2Ctx *http2_ctx = SCCalloc(1, sizeof(OutputHttp2Ctx));
-    if (unlikely(http2_ctx == NULL))
-        return result;
-
-    OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
-    if (unlikely(output_ctx == NULL)) {
-        SCFree(http2_ctx);
-        return result;
-    }
-
-    http2_ctx->eve_ctx = ojc;
-
-    output_ctx->data = http2_ctx;
-    output_ctx->DeInit = OutputHttp2LogDeinitSub;
-
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP2);
-
-    result.ctx = output_ctx;
-    result.ok = true;
-    return result;
-}
-
-void JsonHttp2LogRegister (void)
-{
-    /* also register as child of eve-log */
-    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_TX, "eve-log", MODULE_NAME, "eve-log.http2",
-            OutputHttp2LogInitSub, ALPROTO_HTTP2, JsonHttp2Logger, HTTP2StateClosed,
-            HTTP2StateClosed, JsonHttp2LogThreadInit, JsonHttp2LogThreadDeinit, NULL);
-}
diff --git a/src/output-json-http2.h b/src/output-json-http2.h
deleted file mode 100644 (file)
index 2b30fd7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2020 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Philippe Antoine <p.antoine@catenacyber.fr>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_HTTP2_H
-#define SURICATA_OUTPUT_JSON_HTTP2_H
-
-void JsonHttp2LogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_HTTP2_H */
diff --git a/src/output-json-krb5.c b/src/output-json-krb5.c
deleted file mode 100644 (file)
index 9fc45c5..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2018-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Pierre Chifflier <chifflier@wzdftpd.net>
- *
- * Implement JSON/eve logging app-layer KRB5.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "app-layer-krb5.h"
-#include "output-json-krb5.h"
-
-#include "rust.h"
-
-static int JsonKRB5Logger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    KRB5Transaction *krb5tx = tx;
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *jb = CreateEveHeader(p, LOG_DIR_PACKET, "krb5", NULL, thread->ctx);
-    if (unlikely(jb == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (!rs_krb5_log_json_response(krb5tx, jb)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(jb, thread);
-
-    jb_free(jb);
-    return TM_ECODE_OK;
-
-error:
-    jb_free(jb);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputKRB5LogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_KRB5);
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_KRB5);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonKRB5LogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonKRB5Log", "eve-log.krb5",
-            OutputKRB5LogInitSub, ALPROTO_KRB5, JsonKRB5Logger, JsonLogThreadInit,
-            JsonLogThreadDeinit, NULL);
-
-    SCLogDebug("KRB5 JSON logger registered.");
-}
diff --git a/src/output-json-krb5.h b/src/output-json-krb5.h
deleted file mode 100644 (file)
index 33c7f95..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2015 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Pierre Chifflier <chifflier@wzdftpd.net>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_KRB5_H
-#define SURICATA_OUTPUT_JSON_KRB5_H
-
-void JsonKRB5LogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_KRB5_H */
diff --git a/src/output-json-modbus.c b/src/output-json-modbus.c
deleted file mode 100644 (file)
index 9e508ea..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright (C) 2019-2020 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-#include "output.h"
-#include "output-json.h"
-#include "app-layer.h"
-#include "app-layer-parser.h"
-#include "output-json-modbus.h"
-#include "rust.h"
-
-typedef struct LogModbusFileCtx_ {
-    LogFileCtx *file_ctx;
-    OutputJsonCtx *eve_ctx;
-} LogModbusFileCtx;
-
-typedef struct JsonModbusLogThread_ {
-    LogModbusFileCtx *modbuslog_ctx;
-    OutputJsonThreadCtx *ctx;
-} JsonModbusLogThread;
-
-static int JsonModbusLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
-        void *state, void *tx, uint64_t tx_id)
-{
-    JsonModbusLogThread *thread = thread_data;
-
-    JsonBuilder *js =
-            CreateEveHeader(p, LOG_DIR_FLOW, "modbus", NULL, thread->modbuslog_ctx->eve_ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_OK;
-    }
-    if (!rs_modbus_to_json(tx, js)) {
-        jb_free(js);
-        return TM_ECODE_FAILED;
-    }
-    OutputJsonBuilderBuffer(js, thread->ctx);
-
-    jb_free(js);
-    return TM_ECODE_OK;
-}
-
-static void OutputModbusLogDeInitCtxSub(OutputCtx *output_ctx)
-{
-    LogModbusFileCtx *modbuslog_ctx = (LogModbusFileCtx *)output_ctx->data;
-    SCFree(modbuslog_ctx);
-    SCFree(output_ctx);
-}
-
-static OutputInitResult OutputModbusLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    OutputInitResult result = { NULL, false };
-    OutputJsonCtx *ajt = parent_ctx->data;
-
-    LogModbusFileCtx *modbuslog_ctx = SCCalloc(1, sizeof(*modbuslog_ctx));
-    if (unlikely(modbuslog_ctx == NULL)) {
-        return result;
-    }
-    modbuslog_ctx->file_ctx = ajt->file_ctx;
-    modbuslog_ctx->eve_ctx = ajt;
-
-    OutputCtx *output_ctx = SCCalloc(1, sizeof(*output_ctx));
-    if (unlikely(output_ctx == NULL)) {
-        SCFree(modbuslog_ctx);
-        return result;
-    }
-    output_ctx->data = modbuslog_ctx;
-    output_ctx->DeInit = OutputModbusLogDeInitCtxSub;
-
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MODBUS);
-
-    SCLogDebug("modbus log sub-module initialized.");
-
-    result.ctx = output_ctx;
-    result.ok = true;
-    return result;
-}
-
-static TmEcode JsonModbusLogThreadInit(ThreadVars *t, const void *initdata, void **data)
-{
-    if (initdata == NULL) {
-        SCLogDebug("Error getting context for EveLogModbus. \"initdata\" is NULL.");
-        return TM_ECODE_FAILED;
-    }
-
-    JsonModbusLogThread *thread = SCCalloc(1, sizeof(*thread));
-    if (unlikely(thread == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    thread->modbuslog_ctx = ((OutputCtx *)initdata)->data;
-    thread->ctx = CreateEveThreadCtx(t, thread->modbuslog_ctx->eve_ctx);
-    if (thread->ctx == NULL) {
-        goto error_exit;
-    }
-
-    *data = (void *)thread;
-    return TM_ECODE_OK;
-
-error_exit:
-    SCFree(thread);
-    return TM_ECODE_FAILED;
-}
-
-static TmEcode JsonModbusLogThreadDeinit(ThreadVars *t, void *data)
-{
-    JsonModbusLogThread *thread = (JsonModbusLogThread *)data;
-    if (thread == NULL) {
-        return TM_ECODE_OK;
-    }
-    FreeEveThreadCtx(thread->ctx);
-    SCFree(thread);
-    return TM_ECODE_OK;
-}
-
-void JsonModbusLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonModbusLog", "eve-log.modbus",
-            OutputModbusLogInitSub, ALPROTO_MODBUS, JsonModbusLogger, JsonModbusLogThreadInit,
-            JsonModbusLogThreadDeinit, NULL);
-
-    SCLogDebug("modbus json logger registered.");
-}
diff --git a/src/output-json-modbus.h b/src/output-json-modbus.h
deleted file mode 100644 (file)
index 4c10496..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2019 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef SURICATA_OUTPUT_JSON_MODBUS_H
-#define SURICATA_OUTPUT_JSON_MODBUS_H
-
-void JsonModbusLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_MODBUS_H */
diff --git a/src/output-json-quic.c b/src/output-json-quic.c
deleted file mode 100644 (file)
index 830ac78..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright (C) 2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * Implements JSON/eve logging for Quic app-layer.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-#include "output.h"
-#include "output-json.h"
-#include "app-layer.h"
-#include "app-layer-parser.h"
-#include "output-json-quic.h"
-#include "rust.h"
-
-typedef struct LogQuicFileCtx_ {
-    LogFileCtx *file_ctx;
-    OutputJsonCtx *eve_ctx;
-} LogQuicFileCtx;
-
-typedef struct JsonQuicLogThread_ {
-    LogQuicFileCtx *quiclog_ctx;
-    OutputJsonThreadCtx *ctx;
-} JsonQuicLogThread;
-
-static int JsonQuicLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state,
-        void *tx, uint64_t tx_id)
-{
-    JsonQuicLogThread *thread = thread_data;
-
-    JsonBuilder *js =
-            CreateEveHeader(p, LOG_DIR_PACKET, "quic", NULL, thread->quiclog_ctx->eve_ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_OK;
-    }
-    if (!rs_quic_to_json(tx, js)) {
-        jb_free(js);
-        return TM_ECODE_FAILED;
-    }
-    OutputJsonBuilderBuffer(js, thread->ctx);
-
-    jb_free(js);
-    return TM_ECODE_OK;
-}
-
-static void OutputQuicLogDeInitCtxSub(OutputCtx *output_ctx)
-{
-    LogQuicFileCtx *quiclog_ctx = (LogQuicFileCtx *)output_ctx->data;
-    SCFree(quiclog_ctx);
-    SCFree(output_ctx);
-}
-
-static OutputInitResult OutputQuicLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    OutputInitResult result = { NULL, false };
-    OutputJsonCtx *ajt = parent_ctx->data;
-
-    LogQuicFileCtx *quiclog_ctx = SCCalloc(1, sizeof(*quiclog_ctx));
-    if (unlikely(quiclog_ctx == NULL)) {
-        return result;
-    }
-    quiclog_ctx->file_ctx = ajt->file_ctx;
-    quiclog_ctx->eve_ctx = ajt;
-
-    OutputCtx *output_ctx = SCCalloc(1, sizeof(*output_ctx));
-    if (unlikely(output_ctx == NULL)) {
-        SCFree(quiclog_ctx);
-        return result;
-    }
-    output_ctx->data = quiclog_ctx;
-    output_ctx->DeInit = OutputQuicLogDeInitCtxSub;
-
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_QUIC);
-
-    result.ctx = output_ctx;
-    result.ok = true;
-    return result;
-}
-
-static TmEcode JsonQuicLogThreadInit(ThreadVars *t, const void *initdata, void **data)
-{
-    if (initdata == NULL) {
-        SCLogDebug("Error getting context for EveLogQuic. \"initdata\" is NULL.");
-        return TM_ECODE_FAILED;
-    }
-
-    JsonQuicLogThread *thread = SCCalloc(1, sizeof(*thread));
-    if (unlikely(thread == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    thread->quiclog_ctx = ((OutputCtx *)initdata)->data;
-    thread->ctx = CreateEveThreadCtx(t, thread->quiclog_ctx->eve_ctx);
-    if (thread->ctx == NULL) {
-        goto error_exit;
-    }
-
-    *data = (void *)thread;
-    return TM_ECODE_OK;
-
-error_exit:
-    SCFree(thread);
-    return TM_ECODE_FAILED;
-}
-
-static TmEcode JsonQuicLogThreadDeinit(ThreadVars *t, void *data)
-{
-    JsonQuicLogThread *thread = (JsonQuicLogThread *)data;
-    if (thread == NULL) {
-        return TM_ECODE_OK;
-    }
-    FreeEveThreadCtx(thread->ctx);
-    SCFree(thread);
-    return TM_ECODE_OK;
-}
-
-void JsonQuicLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonQuicLog", "eve-log.quic",
-            OutputQuicLogInitSub, ALPROTO_QUIC, JsonQuicLogger, JsonQuicLogThreadInit,
-            JsonQuicLogThreadDeinit, NULL);
-
-    SCLogDebug("quic json logger registered.");
-}
diff --git a/src/output-json-quic.h b/src/output-json-quic.h
deleted file mode 100644 (file)
index a93a4df..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- */
-
-#ifndef SURICATA_OUTPUT_JSON_QUIC_H
-#define SURICATA_OUTPUT_JSON_QUIC_H
-
-void JsonQuicLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_QUIC_H */
diff --git a/src/output-json-rdp.c b/src/output-json-rdp.c
deleted file mode 100644 (file)
index bc5d9ae..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 2019-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Zach Kelly <zach.kelly@lmco.com>
- *
- * Application layer logger for RDP
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-#include "output.h"
-#include "output-json.h"
-#include "app-layer.h"
-#include "app-layer-parser.h"
-#include "app-layer-rdp.h"
-#include "output-json-rdp.h"
-#include "rust.h"
-
-static int JsonRdpLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *js = CreateEveHeader(p, LOG_DIR_PACKET, "rdp", NULL, thread->ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_OK;
-    }
-    if (!rs_rdp_to_json(tx, js)) {
-        jb_free(js);
-        return TM_ECODE_FAILED;
-    }
-    OutputJsonBuilderBuffer(js, thread);
-
-    jb_free(js);
-    return TM_ECODE_OK;
-}
-
-static OutputInitResult OutputRdpLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RDP);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonRdpLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRdpLog", "eve-log.rdp",
-            OutputRdpLogInitSub, ALPROTO_RDP, JsonRdpLogger, JsonLogThreadInit, JsonLogThreadDeinit,
-            NULL);
-
-    SCLogDebug("rdp json logger registered.");
-}
diff --git a/src/output-json-rdp.h b/src/output-json-rdp.h
deleted file mode 100644 (file)
index 9a400c9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2019 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Zach Kelly <zach.kelly@lmco.com>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_RDP_H
-#define SURICATA_OUTPUT_JSON_RDP_H
-
-void JsonRdpLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_RDP_H */
diff --git a/src/output-json-rfb.c b/src/output-json-rfb.c
deleted file mode 100644 (file)
index e2b832b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 2020-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Frank Honza <frank.honza@dcso.de>
- *
- * Implement JSON/eve logging app-layer RFB.
- */
-
-#include "suricata-common.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "app-layer-rfb.h"
-#include "output-json-rfb.h"
-
-#include "rust-bindings.h"
-
-static int JsonRFBLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *js = CreateEveHeader(p, LOG_DIR_FLOW, "rfb", NULL, thread->ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (!rs_rfb_logger_log(tx, js)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(js, thread);
-    jb_free(js);
-
-    return TM_ECODE_OK;
-
-error:
-    jb_free(js);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputRFBLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RFB);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonRFBLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRFBLog", "eve-log.rfb",
-            OutputRFBLogInitSub, ALPROTO_RFB, JsonRFBLogger, JsonLogThreadInit, JsonLogThreadDeinit,
-            NULL);
-}
diff --git a/src/output-json-rfb.h b/src/output-json-rfb.h
deleted file mode 100644 (file)
index 4411963..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2020 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Frank Honza <frank.honza@dcso.de>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_RFB_H
-#define SURICATA_OUTPUT_JSON_RFB_H
-
-void JsonRFBLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_RFB_H */
diff --git a/src/output-json-sip.c b/src/output-json-sip.c
deleted file mode 100644 (file)
index f147a75..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2018-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Giuseppe Longo <giuseppe@glongo.it>
- *
- * Implement JSON/eve logging app-layer SIP.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "app-layer-sip.h"
-#include "output-json-sip.h"
-
-#include "rust.h"
-
-static int JsonSIPLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    SIPTransaction *siptx = tx;
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *js = CreateEveHeader((Packet *)p, LOG_DIR_PACKET, "sip", NULL, thread->ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_OK;
-    }
-
-    if (!rs_sip_log_json(siptx, js)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(js, thread);
-    jb_free(js);
-
-    return TM_ECODE_OK;
-
-error:
-    jb_free(js);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputSIPLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SIP);
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SIP);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonSIPLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSIPLog", "eve-log.sip",
-            OutputSIPLogInitSub, ALPROTO_SIP, JsonSIPLogger, JsonLogThreadInit, JsonLogThreadDeinit,
-            NULL);
-
-    SCLogDebug("SIP JSON logger registered.");
-}
diff --git a/src/output-json-sip.h b/src/output-json-sip.h
deleted file mode 100644 (file)
index 1d47e5a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2015 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Giuseppe Longo <giuseppe@glongo.it>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_SIP_H
-#define SURICATA_OUTPUT_JSON_SIP_H
-
-void JsonSIPLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_SIP_H */
diff --git a/src/output-json-snmp.c b/src/output-json-snmp.c
deleted file mode 100644 (file)
index cbf0a7c..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 2018-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Pierre Chifflier <chifflier@wzdftpd.net>
- *
- * Implement JSON/eve logging app-layer SNMP.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "app-layer-snmp.h"
-#include "output-json-snmp.h"
-
-#include "rust.h"
-
-static int JsonSNMPLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    SNMPTransaction *snmptx = tx;
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *jb = CreateEveHeader(p, LOG_DIR_PACKET, "snmp", NULL, thread->ctx);
-    if (unlikely(jb == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (!rs_snmp_log_json_response(snmptx, jb)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(jb, thread);
-
-    jb_free(jb);
-    return TM_ECODE_OK;
-
-error:
-    jb_free(jb);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputSNMPLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SNMP);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonSNMPLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSNMPLog", "eve-log.snmp",
-            OutputSNMPLogInitSub, ALPROTO_SNMP, JsonSNMPLogger, JsonLogThreadInit,
-            JsonLogThreadDeinit, NULL);
-
-    SCLogDebug("SNMP JSON logger registered.");
-}
diff --git a/src/output-json-snmp.h b/src/output-json-snmp.h
deleted file mode 100644 (file)
index fa40b0c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2015-2019 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Pierre Chifflier <chifflier@wzdftpd.net>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_SNMP_H
-#define SURICATA_OUTPUT_JSON_SNMP_H
-
-void JsonSNMPLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_SNMP_H */
diff --git a/src/output-json-ssh.c b/src/output-json-ssh.c
deleted file mode 100644 (file)
index 45a8d8e..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 2014-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Victor Julien <victor@inliniac.net>
- *
- * Implements SSH JSON logging portion of the engine.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-print.h"
-#include "util-unittest.h"
-
-#include "util-debug.h"
-#include "app-layer-parser.h"
-#include "output.h"
-#include "app-layer-ssh.h"
-#include "app-layer.h"
-#include "util-privs.h"
-#include "util-buffer.h"
-
-#include "util-logopenfile.h"
-
-#include "output-json.h"
-#include "output-json-ssh.h"
-#include "rust.h"
-
-#define MODULE_NAME "LogSshLog"
-
-static int JsonSshLogger(ThreadVars *tv, void *thread_data, const Packet *p,
-                         Flow *f, void *state, void *txptr, uint64_t tx_id)
-{
-    OutputJsonThreadCtx *thread = thread_data;
-
-    if (unlikely(state == NULL)) {
-        return 0;
-    }
-
-    JsonBuilder *js = CreateEveHeaderWithTxId(p, LOG_DIR_FLOW, "ssh", NULL, tx_id, thread->ctx);
-    if (unlikely(js == NULL))
-        return 0;
-
-    if (!rs_ssh_log_json(txptr, js)) {
-        goto end;
-    }
-    OutputJsonBuilderBuffer(js, thread);
-
-end:
-    jb_free(js);
-    return 0;
-}
-
-static OutputInitResult OutputSshLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonSshLogRegister (void)
-{
-    /* register as child of eve-log */
-    OutputRegisterTxSubModuleWithCondition(LOGGER_JSON_TX, "eve-log", "JsonSshLog", "eve-log.ssh",
-            OutputSshLogInitSub, ALPROTO_SSH, JsonSshLogger, SSHTxLogCondition, JsonLogThreadInit,
-            JsonLogThreadDeinit, NULL);
-}
diff --git a/src/output-json-ssh.h b/src/output-json-ssh.h
deleted file mode 100644 (file)
index 74f24b0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2014 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Victor Julien <victor@inliniac.net>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_SSH_H
-#define SURICATA_OUTPUT_JSON_SSH_H
-
-void JsonSshLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_SSH_H */
diff --git a/src/output-json-template.c b/src/output-json-template.c
deleted file mode 100644 (file)
index 2ca48b7..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (C) 2018-2022 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/*
- * TODO: Update \author in this file and in output-json-template.h.
- * TODO: Remove SCLogNotice statements, or convert to debug.
- * TODO: Implement your app-layers logging.
- */
-
-/**
- * \file
- *
- * \author FirstName LastName <yourname@domain>
- *
- * Implement JSON/eve logging app-layer Template.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "output-json-template.h"
-#include "rust.h"
-
-typedef struct LogTemplateFileCtx_ {
-    uint32_t flags;
-    OutputJsonCtx *eve_ctx;
-} LogTemplateFileCtx;
-
-typedef struct LogTemplateLogThread_ {
-    LogTemplateFileCtx *templatelog_ctx;
-    OutputJsonThreadCtx *ctx;
-} LogTemplateLogThread;
-
-static int JsonTemplateLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
-        void *state, void *tx, uint64_t tx_id)
-{
-    SCLogNotice("JsonTemplateLogger");
-    LogTemplateLogThread *thread = thread_data;
-
-    JsonBuilder *js =
-            CreateEveHeader(p, LOG_DIR_PACKET, "template", NULL, thread->templatelog_ctx->eve_ctx);
-    if (unlikely(js == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (!rs_template_logger_log(tx, js)) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(js, thread->ctx);
-    jb_free(js);
-
-    return TM_ECODE_OK;
-
-error:
-    jb_free(js);
-    return TM_ECODE_FAILED;
-}
-
-static void OutputTemplateLogDeInitCtxSub(OutputCtx *output_ctx)
-{
-    LogTemplateFileCtx *templatelog_ctx = (LogTemplateFileCtx *)output_ctx->data;
-    SCFree(templatelog_ctx);
-    SCFree(output_ctx);
-}
-
-static OutputInitResult OutputTemplateLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
-{
-    OutputInitResult result = { NULL, false };
-    OutputJsonCtx *ajt = parent_ctx->data;
-
-    LogTemplateFileCtx *templatelog_ctx = SCCalloc(1, sizeof(*templatelog_ctx));
-    if (unlikely(templatelog_ctx == NULL)) {
-        return result;
-    }
-    templatelog_ctx->eve_ctx = ajt;
-
-    OutputCtx *output_ctx = SCCalloc(1, sizeof(*output_ctx));
-    if (unlikely(output_ctx == NULL)) {
-        SCFree(templatelog_ctx);
-        return result;
-    }
-    output_ctx->data = templatelog_ctx;
-    output_ctx->DeInit = OutputTemplateLogDeInitCtxSub;
-
-    SCLogNotice("Template log sub-module initialized.");
-
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
-
-    result.ctx = output_ctx;
-    result.ok = true;
-    return result;
-}
-
-static TmEcode JsonTemplateLogThreadInit(ThreadVars *t, const void *initdata, void **data)
-{
-    LogTemplateLogThread *thread = SCCalloc(1, sizeof(*thread));
-    if (unlikely(thread == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (initdata == NULL) {
-        SCLogDebug("Error getting context for EveLogTemplate.  \"initdata\" is NULL.");
-        goto error_exit;
-    }
-
-    thread->templatelog_ctx = ((OutputCtx *)initdata)->data;
-    thread->ctx = CreateEveThreadCtx(t, thread->templatelog_ctx->eve_ctx);
-    if (!thread->ctx) {
-        goto error_exit;
-    }
-    *data = (void *)thread;
-
-    return TM_ECODE_OK;
-
-error_exit:
-    SCFree(thread);
-    return TM_ECODE_FAILED;
-}
-
-static TmEcode JsonTemplateLogThreadDeinit(ThreadVars *t, void *data)
-{
-    LogTemplateLogThread *thread = (LogTemplateLogThread *)data;
-    if (thread == NULL) {
-        return TM_ECODE_OK;
-    }
-    FreeEveThreadCtx(thread->ctx);
-    SCFree(thread);
-    return TM_ECODE_OK;
-}
-
-void JsonTemplateLogRegister(void)
-{
-    /* TEMPLATE_START_REMOVE */
-    if (ConfGetNode("app-layer.protocols.template") == NULL) {
-        return;
-    }
-    /* TEMPLATE_END_REMOVE */
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTemplateLog", "eve-log.template",
-            OutputTemplateLogInitSub, ALPROTO_TEMPLATE, JsonTemplateLogger,
-            JsonTemplateLogThreadInit, JsonTemplateLogThreadDeinit, NULL);
-
-    SCLogNotice("Template JSON logger registered.");
-}
diff --git a/src/output-json-template.h b/src/output-json-template.h
deleted file mode 100644 (file)
index 5a91af5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2018 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author FirstName LastName <name@domain>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_TEMPLATE_RUST_H
-#define SURICATA_OUTPUT_JSON_TEMPLATE_RUST_H
-
-void JsonTemplateLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_TEMPLATE_RUST_H */
diff --git a/src/output-json-tftp.c b/src/output-json-tftp.c
deleted file mode 100644 (file)
index a0bc9ee..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2020-2021 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Clément Galland <clement.galland@epita.fr>
- *
- * Implement JSON/eve logging app-layer TFTP.
- */
-
-#include "suricata-common.h"
-#include "detect.h"
-#include "pkt-var.h"
-#include "conf.h"
-
-#include "threads.h"
-#include "threadvars.h"
-#include "tm-threads.h"
-
-#include "util-unittest.h"
-#include "util-buffer.h"
-#include "util-debug.h"
-#include "util-byte.h"
-
-#include "output.h"
-#include "output-json.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-
-#include "app-layer-tftp.h"
-#include "output-json-tftp.h"
-
-#include "rust.h"
-
-static int JsonTFTPLogger(ThreadVars *tv, void *thread_data,
-    const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
-{
-    OutputJsonThreadCtx *thread = thread_data;
-
-    JsonBuilder *jb = CreateEveHeader(p, LOG_DIR_PACKET, "tftp", NULL, thread->ctx);
-    if (unlikely(jb == NULL)) {
-        return TM_ECODE_FAILED;
-    }
-
-    if (unlikely(!rs_tftp_log_json_request(tx, jb))) {
-        goto error;
-    }
-
-    OutputJsonBuilderBuffer(jb, thread);
-
-    jb_free(jb);
-    return TM_ECODE_OK;
-
-error:
-    jb_free(jb);
-    return TM_ECODE_FAILED;
-}
-
-static OutputInitResult OutputTFTPLogInitSub(ConfNode *conf,
-    OutputCtx *parent_ctx)
-{
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_TFTP);
-    return OutputJsonLogInitSub(conf, parent_ctx);
-}
-
-void JsonTFTPLogRegister(void)
-{
-    /* Register as an eve sub-module. */
-    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTFTPLog", "eve-log.tftp",
-            OutputTFTPLogInitSub, ALPROTO_TFTP, JsonTFTPLogger, JsonLogThreadInit,
-            JsonLogThreadDeinit, NULL);
-
-    SCLogDebug("TFTP JSON logger registered.");
-}
diff --git a/src/output-json-tftp.h b/src/output-json-tftp.h
deleted file mode 100644 (file)
index 40bbf7c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2017 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/**
- * \file
- *
- * \author Clément Galland <clement.galland@epita.fr>
- */
-
-#ifndef SURICATA_OUTPUT_JSON_TFTP_H
-#define SURICATA_OUTPUT_JSON_TFTP_H
-
-void JsonTFTPLogRegister(void);
-
-#endif /* SURICATA_OUTPUT_JSON_TFTP_H */
index 149dda58c2847c54805837e7cb1a711e189c5e96..913717ee23ca73dbe81756ccf56ca46a703cbf21 100644 (file)
 #include "log-httplog.h"
 #include "output-json-http.h"
 #include "output-json-dns.h"
-#include "output-json-modbus.h"
 #include "log-tlslog.h"
 #include "log-tlsstore.h"
 #include "output-json-tls.h"
-#include "output-json-ssh.h"
 #include "log-pcap.h"
+// for SSHTxLogCondition
+#include "app-layer-ssh.h"
 #include "output-json-file.h"
 #include "output-json-smtp.h"
 #include "output-json-stats.h"
 #include "output-json-ftp.h"
 // for misplaced EveFTPDataAddMetadata
 #include "app-layer-ftp.h"
-#include "output-json-tftp.h"
 #include "output-json-smb.h"
 #include "output-json-ike.h"
-#include "output-json-krb5.h"
-#include "output-json-quic.h"
 #include "output-json-dhcp.h"
-#include "output-json-snmp.h"
-#include "output-json-sip.h"
-#include "output-json-rfb.h"
 #include "output-json-mqtt.h"
 #include "output-json-pgsql.h"
-#include "output-json-template.h"
-#include "output-json-rdp.h"
-#include "output-json-http2.h"
 #include "output-lua.h"
 #include "output-json-dnp3.h"
 #include "output-json-metadata.h"
 #include "output-json-dcerpc.h"
 #include "output-json-frame.h"
-#include "output-json-bittorrent-dht.h"
+#include "app-layer-parser.h"
 #include "output-filestore.h"
 
 typedef struct RootLogger_ {
@@ -1034,6 +1025,63 @@ void OutputRegisterRootLoggers(void)
     OutputStreamingLoggerRegister();
 }
 
+static int JsonGenericLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
+        void *state, void *tx, uint64_t tx_id, int dir)
+{
+    OutputJsonThreadCtx *thread = thread_data;
+    EveJsonSimpleAppLayerLogger *al = SCEveJsonSimpleGetLogger(f->alproto);
+    if (al == NULL) {
+        return TM_ECODE_FAILED;
+    }
+
+    const char *name;
+    switch (al->proto) {
+        case ALPROTO_HTTP2:
+            // special case
+            name = "http";
+            break;
+        case ALPROTO_FTPDATA:
+            // underscore instead of dash
+            name = "ftp_data";
+            break;
+        case ALPROTO_BITTORRENT_DHT:
+            // underscore instead of dash
+            name = "bittorrent_dht";
+            break;
+        default:
+            name = AppProtoToString(al->proto);
+    }
+    JsonBuilder *js = CreateEveHeader(p, dir, name, NULL, thread->ctx);
+    if (unlikely(js == NULL)) {
+        return TM_ECODE_FAILED;
+    }
+
+    if (!al->LogTx(tx, js)) {
+        goto error;
+    }
+
+    OutputJsonBuilderBuffer(js, thread);
+    jb_free(js);
+
+    return TM_ECODE_OK;
+
+error:
+    jb_free(js);
+    return TM_ECODE_FAILED;
+}
+
+static int JsonGenericDirPacketLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
+        void *state, void *tx, uint64_t tx_id)
+{
+    return JsonGenericLogger(tv, thread_data, p, f, state, tx, tx_id, LOG_DIR_PACKET);
+}
+
+static int JsonGenericDirFlowLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
+        void *state, void *tx, uint64_t tx_id)
+{
+    return JsonGenericLogger(tv, thread_data, p, f, state, tx, tx_id, LOG_DIR_FLOW);
+}
+
 /**
  * \brief Register all non-root logging modules.
  */
@@ -1058,13 +1106,17 @@ void OutputRegisterLoggers(void)
     /* http log */
     LogHttpLogRegister();
     JsonHttpLogRegister();
-    JsonHttp2LogRegister();
+    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_TX, "eve-log", "LogHttp2Log", "eve-log.http2",
+            OutputJsonLogInitSub, ALPROTO_HTTP2, JsonGenericDirFlowLogger, HTTP2StateClosed,
+            HTTP2StateClosed, JsonLogThreadInit, JsonLogThreadDeinit, NULL);
     /* tls log */
     LogTlsLogRegister();
     JsonTlsLogRegister();
     LogTlsStoreRegister();
     /* ssh */
-    JsonSshLogRegister();
+    OutputRegisterTxSubModuleWithCondition(LOGGER_JSON_TX, "eve-log", "JsonSshLog", "eve-log.ssh",
+            OutputJsonLogInitSub, ALPROTO_SSH, JsonGenericDirFlowLogger, SSHTxLogCondition,
+            JsonLogThreadInit, JsonLogThreadDeinit, NULL);
     /* pcap log */
     PcapLogRegister();
     /* file log */
@@ -1073,7 +1125,11 @@ void OutputRegisterLoggers(void)
     /* dns */
     JsonDnsLogRegister();
     /* modbus */
-    JsonModbusLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonModbusLog", "eve-log.modbus",
+            OutputJsonLogInitSub, ALPROTO_MODBUS, JsonGenericDirFlowLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("modbus json logger registered.");
     /* tcp streaming data */
     LogTcpDataLogRegister();
     /* log stats */
@@ -1094,39 +1150,78 @@ void OutputRegisterLoggers(void)
     /* NFS JSON logger. */
     JsonNFSLogRegister();
     /* TFTP JSON logger. */
-    JsonTFTPLogRegister();
-    /* FTP JSON logger. */
-    JsonFTPLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTFTPLog", "eve-log.tftp",
+            OutputJsonLogInitSub, ALPROTO_TFTP, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("TFTP JSON logger registered.");
+    /* FTP and FTP-DATA JSON loggers. */
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
+            OutputJsonLogInitSub, ALPROTO_FTP, JsonGenericDirFlowLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonFTPLog", "eve-log.ftp",
+            OutputJsonLogInitSub, ALPROTO_FTPDATA, JsonGenericDirFlowLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+    SCLogDebug("FTP JSON logger registered.");
+
     /* SMB JSON logger. */
     JsonSMBLogRegister();
     /* IKE JSON logger. */
     JsonIKELogRegister();
     /* KRB5 JSON logger. */
-    JsonKRB5LogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonKRB5Log", "eve-log.krb5",
+            OutputJsonLogInitSub, ALPROTO_KRB5, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("KRB5 JSON logger registered.");
     /* QUIC JSON logger. */
-    JsonQuicLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonQuicLog", "eve-log.quic",
+            OutputJsonLogInitSub, ALPROTO_QUIC, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("quic json logger registered.");
     /* DHCP JSON logger. */
     JsonDHCPLogRegister();
     /* SNMP JSON logger. */
-    JsonSNMPLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSNMPLog", "eve-log.snmp",
+            OutputJsonLogInitSub, ALPROTO_SNMP, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("SNMP JSON logger registered.");
     /* SIP JSON logger. */
-    JsonSIPLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSIPLog", "eve-log.sip",
+            OutputJsonLogInitSub, ALPROTO_SIP, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+
+    SCLogDebug("SIP JSON logger registered.");
     /* RFB JSON logger. */
-    JsonRFBLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRFBLog", "eve-log.rfb",
+            OutputJsonLogInitSub, ALPROTO_RFB, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
     /* MQTT JSON logger. */
     JsonMQTTLogRegister();
     /* Pgsql JSON logger. */
     JsonPgsqlLogRegister();
     /* Template JSON logger. */
-    JsonTemplateLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonTemplateLog", "eve-log.template",
+            OutputJsonLogInitSub, ALPROTO_TEMPLATE, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
     /* RDP JSON logger. */
-    JsonRdpLogRegister();
+    OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonRdpLog", "eve-log.rdp",
+            OutputJsonLogInitSub, ALPROTO_RDP, JsonGenericDirPacketLogger, JsonLogThreadInit,
+            JsonLogThreadDeinit, NULL);
+    SCLogDebug("rdp json logger registered.");
     /* DCERPC JSON logger. */
     JsonDCERPCLogRegister();
     /* app layer frames */
     JsonFrameLogRegister();
     /* BitTorrent DHT JSON logger */
-    JsonBitTorrentDHTLogRegister();
+    if (ConfGetNode("app-layer.protocols.bittorrent-dht") != NULL) {
+        /* Register as an eve sub-module. */
+        OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonBitTorrentDHTLog",
+                "eve-log.bittorrent-dht", OutputJsonLogInitSub, ALPROTO_BITTORRENT_DHT,
+                JsonGenericDirPacketLogger, JsonLogThreadInit, JsonLogThreadDeinit, NULL);
+    }
 }
 
 static EveJsonSimpleAppLayerLogger simple_json_applayer_loggers[ALPROTO_MAX] = {