2

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)?

1 Answer 1

2

Answers first:

  1. No, this will have no affect.
  2. with 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 and compress. Both could help you out. I think a compression would help you best without loosing information, since log files are usually good to compress.

1
  • I add size 3G rotate 5 compress,which means log files will not bigger than 15G
    – kittygirl
    Commented Nov 11, 2019 at 2:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .