To set the values at runtime, use sysctl
. (I suppose one can write to /proc/sys/kernel/printk
directly too and apparently you can also use dmesg -n CUR
as described here)
Display:
# sysctl kernel.printk
kernel.printk = 2 4 1 7
The separators in the output are single tabs, btw.
Set. Here the separators are just spaces. Works as well.
# sysctl -w kernel.printk="2 4 1 7"
kernel.printk = 2 4 1 7
# sysctl kernel.printk
kernel.printk = 2 4 1 7
See man sysctl
- "configure kernel parameters at runtime" for more.
Reminder of the severity levels and the four values of kernel.printk given by Brian above:
- CUR = current severity level; only messages more important than this level are printed
- DEF = default severity level assigned to messages with no level
- MIN = minimum allowable CUR
- BTDEF = boot-time default CUR
On my CentOS: 7 4 1 7
CUR DEF MIN BTDEF
0 - emergency x x
1 - alert x x x
2 - critical x x
3 - error x x
4 - warning x x x
5 - notice x x
6 - informational V V
7 - debug
This is too noisy, I just want critical and up (no errors). Unlabeled messages should be regarded as warning, so DEF is good:
CUR DEF MIN BTDEF
0 - emergency x x
1 - alert x x x
2 - critical x x
3 - error V V
4 - warning x
5 - notice
6 - informational
7 - debug
Set to: 3 4 1 3
xterm
window, so if the console is flooded it doesn't bother me.)