From 89634b65084fc80e11c177d26d0122cb71638ce2 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Wed, 2 Oct 2019 16:23:05 -0600 Subject: [PATCH] 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 --- src/util-debug.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.47.2