Can I disable the iptables logging without removing the --log-prefix "iptables: " rule?

I have added the following rules into the iptables:

iptables -A INPUT -j LOG --log-prefix "iptables: " --log-level 7

And then configured the rsyslog with this file:


:msg, contains, "iptables: " -/var/log/iptables.log

After restarting the system, iptables can log to the /var/log/iptables.log as expected.

Now, I want to implement this function:

I want to stop the iptables from writing any logs to the real file, including kern.log, dmesg, /var/log/iptables.log, etc.

But I don't want to change the already configured iptables rules.

Is there any other rsyslog configuration can be used for discarding all iptables log without changing any iptables rules?

1 Answer 1


Add & stop at the end of your /etc/rsyslog.d/10-iptables.conf


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .