Logrotate status files extremely large

dulog-rotationlogginglogrotateubuntu-16.04

Apache2 on an Ubuntu 16.04 box was showing issues on the websites it's hosting. It was at 100% capacity. Looking further with du, The majority of the ~100gb hard drive was filled by two files in /var/lib/logrotate/.

logrotate has files in there which are called /var/lib/logrotate/status and /var/lib/logrotate/status.clean and taking up a lot of space… 30gb and 60gb.

I'm aware that logrotate is used to regularly clear log files but it seems that it doesn't clear it's own 'log' files by default. I resolved the disk space issue by deleting the two files in there rm -rf /var/lib/logrotate/*.

(/var/lib/logrotate/status has repopulated with new logs from rotate processes throughout the day)

Is this something that is going to keep happening if logrotate doesn't rotate it's own logs?

Best Answer

Deleting or rotating the logrotate.status file is only a band-aid. You need to take a step backward and ask the question, "why is the logrotate.status file that large?"

I would tail -n 500 that status file and see what files are listed in there. I think there's a real strong possibility that your logrotate config file(s) are rotating stuff you never intended to be rotated.