How to disable dmesg output printing on the console


How to disable kernel messages (dmesg) Flooding on the console

Method. 1

Edit the syslog config file /etc/rsyslog.conf and do the following modification.

#kern.*                                                 /dev/console
Unhide and Modify the above line as below
kern.*                                                 /dev/null

Restart the rsyslog service
#service rsyslog restart

Method. 2

If the above method is not solving the problem, then try changing the dmesg log level.

To see the current log level
#sysctl kernel.printk
4       4       1       7

To Change the log level

#dmesg -n (log level)

#dmesg -n 1

#sysctl kernel.printk
      4       1       7To fix at each reboot, add the following line to /etc/rc.local file
dmesg -n 1

Supported log levels (priorities):

0 – emerg – system is unusable
1 – alert – action must be taken immediately
2 –  crit – critical conditions
3 –     err – error conditions
4 –    warn – warning conditions
5 –  notice – normal but significant condition
6 –    info – informational
7 –   debug – debug-level messages