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.
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
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_NOTICE||5||Normal but significant condition|
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.