I am just an ordinary, (if there is such a thing,) user. I have never considered log levels in my many years of using Linux…so what s up with log levels?
The Kernel Docs have a good roundup:
loglevel= [KNL,EARLY]
All Kernel Messages with a loglevel smaller than the
console loglevel will be printed to the console. It can
also be changed with klogd or other programs. The
loglevels are defined as follows:
0 (KERN_EMERG) system is unusable
1 (KERN_ALERT) action must be taken immediately
2 (KERN_CRIT) critical conditions
3 (KERN_ERR) error conditions
4 (KERN_WARNING) warning conditions
5 (KERN_NOTICE) normal but significant condition
6 (KERN_INFO) informational
7 (KERN_DEBUG) debug-level messages
You can query the default console log levels using
$ cat /proc/sys/kernel/printk
or
$ sysctl kernel.printk
Output will look like:
kernel.printk = 4 4 1 4
where
-
the first value in our output is the current
console_loglevel. This is the information we were looking for: the value,4in this case, represents the log level currently used. As said before this means that only messages adopting a severity level higher than it, will be displayed on the console. -
the second value in the output represents the
default_message_loglevel. This value is automatically used for messages without a specific log level: if a message is not associated with a log level, this one will be used for it. -
the third value in the output reports the
minimum_console_loglevelstatus. It indicates the minimum loglevel which can be used forconsole_loglevel. The level here used it’s1, the highest. -
the fourth value represents the
default_console_loglevel, which is the default loglevel used forconsole_loglevelat boot time.
[g@g-xps8940 ~]$ cat /proc/sys/kernel/printk
4 4 1 4
Your example is my situation. Interesting, but in my case, I am guessing log level is probably nothing I need to be concerned with. I can think of no reason why log level should matter to me. At-any-rate, thanks for your explanation.![]()
So does setting kernel parameter loglevel=5 or loglevel=6 in GRUB or SystemD-boot actually changes any of these values? If yes then which of the values changes?
The first, so you see what’s current and can still check the defaults:
Example, setting kernel loglevel=5:
$ cat /proc/sys/kernel/printk
5 4 1 4
Thanks and any other way to change the other values, i.e. default_message_loglevel, minimum_console_loglevel and default_console_loglevel?
I never found the need to change the others, don’t know, tbh. Maybe these are even kernel constants, who knows…
EDIT: man 2 syslog has a bit more information.