In my iptables, I have a rule which logs dropped packets:
-A INPUT -i eth0 -j LOG --log-prefix "FW: " --log-level 7
-A INPUT -i eth0 -j DROP
And in /etc/rsyslog.conf
, I have another rule which sends these logs to a dedicated file /var/log/firewall.log
.
:msg, contains, "FW: " -/var/log/firewall.log
& ~
The & ~
deletes the logs immediately, so that they don't flood syslog
or other log files.
This works well, except that it floods dmesg
with those firewall logs (not /var/log/dmesg
but the output of command dmesg
).
Is there a way to prevent these logs being shown in dmesg
?
dmesg
being flooded, not about firewall rules.ulogd2
. That is how I solved the problem.