What if logrotate does not rotate files..

11 January 2016

Recently I was confrontated with a strange problem. Logrotate did not rotate logfiles. When I started it in debug-mode I got the following message:

empty log files are not rotated, old logs are removed considering log /var/log/syslog log does not need rotating not running postrotate script, since no logs were rotated

The problem was that some logfiles had a zero size so logrotate did not rotate them. It was quite easy to solve the problem by deleting the files:

find /var/log/ -size 0 -exec rm {} \;

BTW: while I was searching the problem I did not read the manual properly: logrotate -d does not rotate the files! It just prints out debug-messages.

-d, –debug
Turns on debug mode and implies -v. In debug mode, no changes will be made to the
logs or to the logrotate state file.

[ Linux  Sysadmin  logrotate  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti