]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling: create a LOGGER_USER id
authorJason Ish <jason.ish@oisf.net>
Wed, 28 Aug 2024 14:55:35 +0000 (08:55 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
Loggers need an ID uniquely identify them for profiling. To help with
loggers registered at runtime (library, plugins), provide a
LOGGER_USER that can be used. It won't provide per-logger details if
they have more than one, but will provide a total for all their
registered loggers.

Ticket: #7227

src/suricata-common.h
src/util-profiling.c

index 3a6c281cab9053edf0df91f55d737450b1771cd4..51af99a023e88b5b246b884e741fd20c3d5dd77a 100644 (file)
@@ -493,6 +493,10 @@ typedef enum {
     LOGGER_JSON_STREAM,
     LOGGER_JSON_ARP,
 
+    /* An ID that can be used by loggers registered by plugins and/or
+     * library users. */
+    LOGGER_USER,
+
     /* Must come last. */
     LOGGER_SIZE,
 } LoggerId;
index f5efc45876f3b6f2bfbac58abefc76811acafe55..56c31557285bce39a66c69db4684125b9f593a01 100644 (file)
@@ -1298,6 +1298,7 @@ const char *PacketProfileLoggerIdToString(LoggerId id)
         CASE_CODE(LOGGER_JSON_FRAME);
         CASE_CODE(LOGGER_JSON_STREAM);
         CASE_CODE(LOGGER_JSON_ARP);
+        CASE_CODE(LOGGER_USER);
 
         case LOGGER_SIZE:
             return "UNKNOWN";