Sometimes, fail2ban create huge log file in my Centos 7 server.
2.9G fail2ban.log
2.7G fail2ban.log-20191102
17G fail2ban.log-20191109
Then,I have questions as below:
1.If I delete fail2ban.log-20191109
,will affect the functioning of fail2ban?
2.how to restrict fail2ban.log
size?(say no more than 2G)?
Answers first:
logrotate
.First of all, your
-2019xxxx
files have no direct connection to fail2ban. They have not even been created by fail2ban in first place.fail2ban will always append to its logfile
fail2ban.log
. But there should be a logrotate config in/etc/logrotate.d
for the fail2ban logs.See the logrotate man page on how to configure it (I recommend to read the full man page - logrotate is a great tool ;-) ). Search for
size
andcompress
. Both could help you out. I think a compression would help you best without loosing information, since log files are usually good to compress.