]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
logging: unique id's per log direction
authorVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2018 18:46:06 +0000 (19:46 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2018 19:33:04 +0000 (20:33 +0100)
For loggers that register once per direction, use unique id's per
direction.

Reshuffle id's to keep tx log id's low so we can use u32 for tracking
logged loggers.

src/log-dnslog.c
src/output-json-dnp3.c
src/output-json-dns.c
src/suricata-common.h
src/util-profiling.c

index 4da35ff75cdcb50cdec06f005397e5aad9f4577f..31867ba748af5404b04b69287048aaf132378f57 100644 (file)
@@ -362,12 +362,12 @@ void LogDnsLogRegister (void)
 {
 #ifndef HAVE_RUST
     /* Request logger. */
-    OutputRegisterTxModuleWithProgress(LOGGER_DNS, MODULE_NAME, "dns-log",
+    OutputRegisterTxModuleWithProgress(LOGGER_DNS_TS, MODULE_NAME, "dns-log",
         LogDnsLogInitCtx, ALPROTO_DNS, LogDnsRequestLogger, 0, 1,
         LogDnsLogThreadInit, LogDnsLogThreadDeinit, LogDnsLogExitPrintStats);
 
     /* Response logger. */
-    OutputRegisterTxModuleWithProgress(LOGGER_DNS, MODULE_NAME, "dns-log",
+    OutputRegisterTxModuleWithProgress(LOGGER_DNS_TC, MODULE_NAME, "dns-log",
         LogDnsLogInitCtx, ALPROTO_DNS, LogDnsResponseLogger, 1, 1,
         LogDnsLogThreadInit, LogDnsLogThreadDeinit, LogDnsLogExitPrintStats);
 
index 45efbfc771e49a2baf92573b1d5b1d47e9ffa0c4..67025cb8e47e337ac337a9b5ac9c98b4acfbc655 100644 (file)
@@ -430,11 +430,11 @@ static TmEcode JsonDNP3LogThreadDeinit(ThreadVars *t, void *data)
 void JsonDNP3LogRegister(void)
 {
     /* Register direction aware eve sub-modules. */
-    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNP3, "eve-log",
+    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNP3_TS, "eve-log",
         "JsonDNP3Log", "eve-log.dnp3", OutputDNP3LogInitSub, ALPROTO_DNP3,
         JsonDNP3LoggerToServer, 0, 1, JsonDNP3LogThreadInit,
         JsonDNP3LogThreadDeinit, NULL);
-    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNP3, "eve-log",
+    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNP3_TC, "eve-log",
         "JsonDNP3Log", "eve-log.dnp3", OutputDNP3LogInitSub, ALPROTO_DNP3,
         JsonDNP3LoggerToClient, 1, 1, JsonDNP3LogThreadInit,
         JsonDNP3LogThreadDeinit, NULL);
index d18ca84b8422cc4411800e36135ea14fbefe2183..af962914723dacb29fe5b50156c7611796c6da72 100644 (file)
@@ -935,23 +935,23 @@ static OutputCtx *JsonDnsLogInitCtx(ConfNode *conf)
 void JsonDnsLogRegister (void)
 {
     /* Logger for requests. */
-    OutputRegisterTxModuleWithProgress(LOGGER_JSON_DNS, MODULE_NAME,
+    OutputRegisterTxModuleWithProgress(LOGGER_JSON_DNS_TS, MODULE_NAME,
         "dns-json-log", JsonDnsLogInitCtx, ALPROTO_DNS, JsonDnsLoggerToServer,
         0, 1, LogDnsLogThreadInit, LogDnsLogThreadDeinit, NULL);
 
     /* Logger for replies. */
-    OutputRegisterTxModuleWithProgress(LOGGER_JSON_DNS, MODULE_NAME,
+    OutputRegisterTxModuleWithProgress(LOGGER_JSON_DNS_TC, MODULE_NAME,
         "dns-json-log", JsonDnsLogInitCtx, ALPROTO_DNS, JsonDnsLoggerToClient,
         1, 1, LogDnsLogThreadInit, LogDnsLogThreadDeinit, NULL);
 
     /* Sub-logger for requests. */
-    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNS, "eve-log",
+    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNS_TS, "eve-log",
         MODULE_NAME, "eve-log.dns", JsonDnsLogInitCtxSub, ALPROTO_DNS,
         JsonDnsLoggerToServer, 0, 1, LogDnsLogThreadInit,
         LogDnsLogThreadDeinit, NULL);
 
     /* Sub-logger for replies. */
-    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNS, "eve-log",
+    OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_DNS_TC, "eve-log",
         MODULE_NAME, "eve-log.dns", JsonDnsLogInitCtxSub, ALPROTO_DNS,
         JsonDnsLoggerToClient, 1, 1, LogDnsLogThreadInit, LogDnsLogThreadDeinit,
         NULL);
index 15c8e2f31c48448a870be7241b94622674fc81e2..e43cfc9518dcf471365f73580a2b6a6abd10c7f1 100644 (file)
@@ -399,6 +399,24 @@ typedef enum PacketProfileDetectId_ {
 
 typedef enum {
     LOGGER_UNDEFINED,
+
+    /* TX loggers first for low logger IDs */
+    LOGGER_DNS_TS,
+    LOGGER_DNS_TC,
+    LOGGER_HTTP,
+    LOGGER_TLS_STORE,
+    LOGGER_TLS,
+    LOGGER_JSON_DNS_TS,
+    LOGGER_JSON_DNS_TC,
+    LOGGER_JSON_HTTP,
+    LOGGER_JSON_SMTP,
+    LOGGER_JSON_TLS,
+    LOGGER_JSON_NFS,
+    LOGGER_JSON_DNP3_TS,
+    LOGGER_JSON_DNP3_TC,
+    LOGGER_JSON_SSH,
+    LOGGER_JSON_TEMPLATE,
+
     LOGGER_ALERT_DEBUG,
     LOGGER_ALERT_FAST,
     LOGGER_UNIFIED2,
@@ -406,17 +424,6 @@ typedef enum {
     LOGGER_DROP,
     LOGGER_JSON_ALERT,
     LOGGER_JSON_DROP,
-    LOGGER_JSON_SSH,
-    LOGGER_DNS,
-    LOGGER_HTTP,
-    LOGGER_JSON_DNS,
-    LOGGER_JSON_HTTP,
-    LOGGER_JSON_SMTP,
-    LOGGER_JSON_TLS,
-    LOGGER_JSON_NFS,
-    LOGGER_JSON_TEMPLATE,
-    LOGGER_TLS_STORE,
-    LOGGER_TLS,
     LOGGER_FILE,
     LOGGER_FILE_STORE,
     LOGGER_JSON_FILE,
@@ -427,7 +434,6 @@ typedef enum {
     LOGGER_JSON_STATS,
     LOGGER_PRELUDE,
     LOGGER_PCAP,
-    LOGGER_JSON_DNP3,
     LOGGER_JSON_VARS,
     LOGGER_SIZE,
 } LoggerId;
index cc0e095cccc96e5cff26c0afd696f7c085835553..58b17b7db173bc4aa97638e3554c45f677b7775b 100644 (file)
@@ -1341,9 +1341,11 @@ const char * PacketProfileLoggertIdToString(LoggerId id)
         CASE_CODE (LOGGER_JSON_ALERT);
         CASE_CODE (LOGGER_JSON_DROP);
         CASE_CODE (LOGGER_JSON_SSH);
-        CASE_CODE (LOGGER_DNS);
+        CASE_CODE (LOGGER_DNS_TS);
+        CASE_CODE (LOGGER_DNS_TC);
         CASE_CODE (LOGGER_HTTP);
-        CASE_CODE (LOGGER_JSON_DNS);
+        CASE_CODE (LOGGER_JSON_DNS_TS);
+        CASE_CODE (LOGGER_JSON_DNS_TC);
         CASE_CODE (LOGGER_JSON_HTTP);
         CASE_CODE (LOGGER_JSON_SMTP);
         CASE_CODE (LOGGER_JSON_TLS);