How to Enable Iptables Logging on Linux [ Easy Guide ]
Saad Shafqat, 2 years ago 0 2 min read 9669
Enabling logging on Iptables aids in tracking traffic to our server. We can also use this to estimate the number of hits generated by any IP address. This article will show you how to enable logging for all packets filtered by Iptables.
Enable Iptables Logging
To Enable Iptables Logging, simply run the following command.
We can also define the IP address or range from which the log will be generated.
Use –log-level followed by a number to define the level of LOG provided by Iptables.
We can also add a prefix to the generated logs to make it easier to find logs in a big file.
Check Iptables Log
After enabling logging on Iptables. Check logs generated by Iptables according to your operating system by looking at the following log files.
Check logs On Ubuntu and Debian
The kernel generates the Iptables logs. As a result, take a look at the kernel log file below.
Check Logs on CentOS/RHEL and Fedora
Change the name of the Iptables LOG file
To change the name of the iptables log file, edit the /etc/rsyslog.conf file and apply the following configuration.
Insert the following line:
Now, use the following command to restart the rsyslog service.
2021’s Top Cloud Computing Trends
Yehiweb's founder and chief editor. Working as an IT Professional And Freelance Content Writer Since 2012.
PDF Drive: How to Draw On A PDF
Adnan Mujic, 3 weeks ago 5 min read
5 Ways HVAC Software Enables Remote Monitoring and Control of HVAC Business Field Operations
HVAC (Heating, Ventilation, and Air Conditioning) businesses rely heavily on their field operations to maintain, repair, and install HVAC systems…
Leave a Reply