From: Jason Ish Date: Wed, 2 Oct 2019 22:23:05 +0000 (-0600) Subject: logging: respect individual log levels X-Git-Tag: suricata-5.0.0~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89634b65084fc80e11c177d26d0122cb71638ce2;p=thirdparty%2Fsuricata.git logging: respect individual log levels 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 --- diff --git a/src/util-debug.c b/src/util-debug.c index 608580f505..aea8be7400 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -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);