Linux – How to stop kernel critical messages from printing to terminal

kernellinuxlogging

I have a system that is un-usable because I keep getting logs every second from the kernel. The system can actually start up and in the little spaces between the messages I can actually log in. But the kernel just keeps throwing this message every second on the screen(all the terminals). I want to know if there's a way to stop kernel from spewing these messages or at least redirect them somewhere else.

Best Answer

Your kernel should not spit critical messages every seconds. So the first thing to do is to fix your kernel or your hardware. However, if you persist in this way You can choose the level of message that will be displayed using

echo <level> >/proc/sys/kernel/printk

Higher level, means higher verbosity. The default is 4, and the levels are defined as follows :

#define KERN_EMERG      "<0>"   /* system is unusable                   */
#define KERN_ALERT      "<1>"   /* action must be taken immediately     */
#define KERN_CRIT       "<2>"   /* critical conditions                  */
#define KERN_ERR        "<3>"   /* error conditions                     */
#define KERN_WARNING    "<4>"   /* warning conditions                   */
#define KERN_NOTICE     "<5>"   /* normal but significant condition     */
#define KERN_INFO       "<6>"   /* informational                        */
#define KERN_DEBUG      "<7>"   /* debug-level messages                 */

This is not really a programming question however, maybe it is more suited on another site.