home | list info | list archive | date index | thread index

how to filter kernel messages via the kernel command line?

  current colleague asked me how to cut down the console generation of
kernel messages on a system that uses the original syslog, not rsyslog
or syslog-ng, and since i'm currently using systemd/journalctl, i
can't really test this so here's what should be a simple question.

  my first suggestion was just configure /etc/sysctl.conf in userspace
to avoid the console display of low-priority (debug, info) kernel
messages -- send them to a file, or /dev/null, or whatever. because if
the current setting in /etc/sysctl.conf is:

  kern.*	/dev/console

well, that's kind of where the problem is.

  however, an extra restriction is that i am not allowed to mess with
anything in userspace, so tweaking /etc/sysctl.conf is out. so i
checked out the "loglevel" kernel parameter, which is explained
thusly:

  loglevel=   All Kernel Messages with a loglevel smaller than the
              console loglevel will be printed to the console. It can
              also be changed with klogd or other programs. The
              loglevels are defined as follows:

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

so it *appears* that if i wanted only(?) emerg and alert messages sent
to the console, i would set "loglevel=2" at the command line.

  but from the explanation, i'm not convinced that's a solution
because the above says only that those two priorities would be sent to
the console -- it says nothing about what would happen to all of the
others. specifically, it's not clear to me how setting loglevel on the
command line interacts with that is *already* in /etc/sysctl.conf.

  what if /etc/sysctl.conf does indeed contain the line:

  kern.*	/dev/console

how does loglevel interact with that? does it override it? or does it
complement it? or what if /etc/sysctl.conf contained the line:

  kern.*	/dev/null

would the loglevel setting override that?

  in short, is there a way on the kernel command line to reduce the
generation of kernel messages to the system console, regardless of the
settings in /etc/sysctl.conf?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org