How to configure iptables firewall logs

Source: Internet
Author: User
Configure the syslogd configuration file/etc/syslog. for details about the conf record level, you can view the file syslog. conf generally has the following levels: debug, info, notice, warning, warn, err, error, crit, alert, emerg, panic. Among them, error and err, warn and wa Configure the syslogd configuration file/etc/syslog. conf
For details about the record level, you can view the file syslog. conf. Generally, there are the following levels:
Yes: debug, info, notice, warning, warn, err, error, crit, alert, emerg, panic. Here, error and err, warn, warning, panic, and emerg are synonyms, that is, they play the same role. Note that these three levels are not in favor of use (because the amount of information is too large ).

1. add the following content in the file syslog. conf:
# Iptables logging
Kern.info/var/log/ Iptables

2. Insert iptables to Mark icmp restricted logs as info-level
Iptables-a input-p icmp-m limit -- limit 10/s-j LOG -- log-levelINFO -- log-prefix "ICMP packet I :"

3. add the IPtables log file/var/log/iptables to The syslog rolling log configuration file/etc/logrotate. d/syslog. The details are as follows:
/Var/log/iptables/var/log/messages/var/log/secure/var/log/maillog/var/log/spooler/var/log/boot. log/var/log/cron {
Sharedscripts
Postrotate
/Bin/kill-HUP 'cat/var/run/syslogd. pid 2>/dev/Null' 2>/dev/null | true
Endscript
}

4. restart syslog
Service syslog restart
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.