0

I have an embedded device running embedded linux and I connect to it using a serial port. I am capturing the logs I need using cat proc/kmsg into a file in a background process. I would like to not see these messages in the terminal, but just use the log file.

How can I configure linux for this? If it's possible to configure all messages besides critical not to appear in the terminal that's even better.

Thanks, Michal

1 Answer 1

3

You probably want to read http://lxr.free-electrons.com/source/Documentation/sysctl/kernel.txt#L480

Basically, you can write your configuration to /proc/sys/kernel/printk.

Knowing that the following levels are defined:

   #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             */

For what you want to do, I would suggest using

echo 3 > /proc/sys/kernel/printk

which will print only emergencies, alerts and error messages.

1
  • Thanks! I tried this and it worked. Is there a way to set this permemantly so it applies also after I reboot my device?
    – michalv82
    Commented Oct 22, 2013 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .