Reduce Kernel Messages in rsyslogd

In the standard rsyslog setup of Ubuntu a kernel message goes to 3 log files (syslog, messages and kern.log), i.e. running LOG targets in your firewall setup can really hog your /var/log volume.

I decided to simply discard the kernel messages after logging them to kern.log.

So I placed the following lines on top of the rules in /etc/rsyslog.conf:

kern.*  -/var/log/kern.log
kern.*  ~

If you prefer patch syntax instead, please find it for Ubuntu 9.10 in the following lines:

--- rsyslog.conf.2010-03-21	2010-03-21 13:32:33.569483476 +0100
+++ rsyslog.conf	2010-03-21 13:52:12.741483012 +0100
@@ -52,11 +52,12 @@
 #
 # First some standard log files.  Log by facility.
 #
+kern.*				-/var/log/kern.log
+kern.*				~
 auth,authpriv.*			/var/log/auth.log
 *.*;auth,authpriv.none		-/var/log/syslog
 #cron.*				/var/log/cron.log
 daemon.*			-/var/log/daemon.log
-kern.*				-/var/log/kern.log
 lpr.*				-/var/log/lpr.log
 mail.*				-/var/log/mail.log
 user.*				-/var/log/user.log