]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
debug/log: add log level for JSON type
authorEric Urban <bluediscus@hotmail.com>
Mon, 12 Nov 2018 18:38:50 +0000 (12:38 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 3 Dec 2018 13:23:25 +0000 (14:23 +0100)
resolves #2671

src/util-debug.c

index b72edf3d2a0386baf39b1ff645ee32da036d68fc..40c9fc0a0f86623a05245842dd08cc8b80a304fd 100644 (file)
@@ -222,6 +222,13 @@ static int SCLogMessageJSON(struct timeval *tval, char *buffer, size_t buffer_si
     CreateIsoTimeString(tval, timebuf, sizeof(timebuf));
     json_object_set_new(js, "timestamp", json_string(timebuf));
 
+    const char *s = SCMapEnumValueToName(log_level, sc_log_level_map);
+    if (s != NULL) {
+        json_object_set_new(js, "log_level", json_string(s));
+    } else {
+        json_object_set_new(js, "log_level", json_string("INVALID"));
+    }
+
     json_object_set_new(js, "event_type", json_string("engine"));
 
     if (error_code > 0) {