- Make sure you have --log-prefix set in your iptables entries. e.g.
iptables -A INPUT -j LOG --log-prefix "[IPTABLES "
- Create & edit /etc/rsyslog.d/15-iptables.conf file, and add the following lines:
:msg,contains,"[IPTABLES " /var/log/iptables.log & ~
- Create & edit /etc/logrotate.d/iptables file, and add the following lines:
/var/log/iptables.log { rotate 4 weekly missingok notifempty compress delaycompress sharedscripts postrotate reload rsyslog >/dev/null 2>&1 || true endscript }
- Restart rsyslogd:
sudo /etc/init.d/rsyslog restart
Search This Blog
Enable iptables logging on Ubuntu Linux
The following solution can enable the iptables logging to /var/log/iptables.log:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment