]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
logging: respect individual log levels
authorJason Ish <jason.ish@oisf.net>
Wed, 2 Oct 2019 22:23:05 +0000 (16:23 -0600)
committerVictor Julien <victor@inliniac.net>
Thu, 10 Oct 2019 05:41:05 +0000 (07:41 +0200)
The log level of individual loggers (console, file, syslog) was
being capped by the default log level. For example, if the
default log level was notice, setting the file level to info
would still result in notice level logging.

Bug #3210

src/util-debug.c

index 608580f5059799c5fce2d35f6831e53abf0c0279..aea8be74002178b00f12598bd890f609d3661382 100644 (file)
@@ -1298,6 +1298,7 @@ void SCLogLoadConfig(int daemon, int verbose)
     ConfNode *outputs;
     SCLogInitData *sc_lid;
     int have_logging = 0;
+    int max_level = 0;
 
     outputs = ConfGetNode("logging.outputs");
     if (outputs == NULL) {
@@ -1385,6 +1386,7 @@ void SCLogLoadConfig(int daemon, int verbose)
                     level_s);
                 exit(EXIT_FAILURE);
             }
+            max_level = MAX(max_level, level);
         }
 
         if (strcmp(output->name, "console") == 0) {
@@ -1442,6 +1444,8 @@ void SCLogLoadConfig(int daemon, int verbose)
                    " 'logging.outputs' in the YAML.");
     }
 
+    /* Set the global log level to that of the max level used. */
+    sc_lid->global_log_level = MAX(sc_lid->global_log_level, max_level);
     SCLogInitLogModule(sc_lid);
 
     SCLogDebug("sc_log_global_log_level: %d", sc_log_global_log_level);