修改文件/etc/rsyslog.conf 加入
#DIY iptables Log save #kern.warning /var/log/iptables/iptables.log kern.debug /var/log/iptables/iptables.log
修改文件/etc/sysconfig/iptables
-A INPUT -p tcp -m limit --limit 1/sec -j LOG --log-level 7
service rsyslog restart
service iptables restart
# 清理和压缩每天产生的大量日志
#!/bin/bash #clear iptables Log YY=`date +%Y` mm=`date +%m` dd=`date +%d` Basedic='/var/log/iptables' cd $Basedic /bin/mkdir -p ${YY}/${mm} /bin/mv iptables.${YY}${mm}* ${YY}/${mm} ~ # clean up 循环删除1年前日志find /var/log/iptables/ -type f -mtime +365 -exec rm -f {} \;
参考内容:https://blog.csdn.net/WQ7X/article/details/105220711
标签:iptables,log,mm,IP,YY,CentOS6,var,日志 From: https://www.cnblogs.com/Cong0ks/p/16627593.html