How to stop kernel messages from flooding my console?

转载 2016年08月30日 09:20:42

I suggest you alter your /etc/sysctl.conf. Specifcally, you want to tweak the kernel.printk line.

# Uncomment the following to stop low-level messages on console
kernel.printk = 3 4 1 3

I am not sure what the centos default settings are, but I seems likely that have things set more verbose then you need.

Also do see the shorewall section on logging. You don't have to use the LOG target for logging, you can use other tools, or adjust the log severity, and tweak things to control where you messages go.



To set the values at runtime, use sysctl. (I suppose one can write to /proc/sys/kernel/printkdirectly 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

How to configure the kernel parameter "console"

The Linux kernel is configured to select the console by passing it the console parameter. The consol...

How to instantiate I2C devices[Doc-from-kernel]

 1 How to instantiate I2C devices2 ==============================34 Unlike PCI or USB devices...
  • fall4u
  • fall4u
  • 2011年04月11日 10:52
  • 202

How to instantiate I2C devices(From kernel-tree/Documentation/i2c)

How to instantiate I2C devices ============================== Unlike PCI or USB devices, I2C devic...

How-to suppress error popup for inline messages __jspx页面弹出消息提示框

Error messages in ADF Faces are displayed in a DHTML popup dialog.  To change this behavior so messa...

How to with 7bit encoding in concatenated sms messages

Where11- udl05- udhl00- IE03- IEL03- reference number03 - total number of SMS03 - 3/3 smsFill bits h...

Oracle 11g Data Guard: How to start and stop Redo Apply

1 Starting Redo Apply   To start apply services on a physical standby database, ensure thephysical...

WPF--How to handle WndProc messages in WPF?

How to handle WndProc messages in WPF?up vote7down votefavorite4Finding WPF a steep learning curve. ...
  • rise51
  • rise51
  • 2011年01月13日 14:02
  • 1023

How to Stop Overthinking Everything: 9 Simple Habits

What is holding people back from the life that they truly want to live? I’d say that one very...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How to stop kernel messages from flooding my console?
举报原因:
原因补充:

(最多只允许输入30个字)