Disabling iptables Console Messages

I’ve been searching for a solution to this and finally found one, so I’m posting it here just so I won’t have to search for it when I forget it again.

I initially thought the messages were coming from syslog-ng but it turned out that the messages kept coming even with syslog-ng turned off.

As it turns out, the kernel was printing those messages directly to the console. Fortunately, it’s possible to set the minimal level a message must have before it is printed to the console.

# dmesg -n 4

After executing this command, only messages having level “warning” (4) or higher will be printed. All message levels are still logged.