Lish console consantly prints iptables logging
I'm using a Lish console.
IPtable logs keep interrupting the command line.
Log lines are printing to std out:
iptables denied: IN=eth0 OUT= MAC=f2:3c:91…
I turned off ufw and fail2ban, it doesn't help.
I do not have the problem when access the console via SSH.
How can I fix this?
Thanks for your help.
3 Replies
The short answer
The reason you do not see the messages when you login through SSH is that you are not looking at the console.
As root, edit the /etc/sysctl.cfg
file and add, edit, or uncomment the following line: (Be sure to make a note of the old settings in case you need to change them back later.)
kernel.printk = 3 4 1 3
This will cause the console messages to stop at the next boot.
If you wish to change the running configuration, you can use the sysctl
command:
sudo sysctl -w kernel.printk="3 4 1 3"
This should solve the problem for the majority of cases. Other programs are capable of writing to the console directly, and various other logging mechanisms exist that could cause different behavior on different systems.
The long answer
Console logging of kernel messages is very flexible. At the kernel level there is the concept of a "severity level" with lower numbers meaning messages that are more important to see.
There is a default severity level that is compiled into the kernel, but you can override this at boot time by passing the kernel a LOGLEVEL=n
parameter, when n is the LOGLEVEL you want.
Different Linux distributions likely make different choices about the default LOGLEVEL.
The parameters in the above 'solution' represent respectively:
- The Current LOGLEVEL.
- The Default LOGLEVEL to give to messages that don't report one.
- The Minimum allowable Current LOGLEVEL.
- The LOGLEVEL assigned at boot time.
The different LOGLEVELs (from the syslog(2) man page):
Kernel constant | Level value | Meaning |
---|---|---|
KERN_EMERG | 0 | System is unusable |
KERN_ALERT | 1 | Action must be taken immediately |
KERN_CRIT | 2 | Critical conditions |
KERN_ERR | 3 | Error conditions |
KERN_WARNING | 4 | Warning conditions |
KERN_NOTICE | 5 | Normal but significant condition |
KERN_INFO | 6 | Informational |
KERN_DEBUG | 7 | Debug-level messages |
For more information, see the syslog(2) manual page. If it is not installed on your system, you will want to install the manpages-dev and manpages-posix-dev packages for your distribution.
hphillips, Thanks a million.