Description of problem: ----------------------- Logrotate does not rotate logs when using the debug (-d) and force (-f) parameters. Version-Release number of selected component (if applicable): ------------------------------------------------------------- logrotate-3.6.9-2.RHEL3 How reproducible: ----------------- Running logrotate with -d and -f parameters. Not tested without -f parameter. Steps to Reproduce: ------------------- This is the directory containing the logs in question: ---8<--- root@rhpatch:/u02/bosse/logg$ ls -l total 2207868 -rw-r--r-- 1 root root 1152430080 Mar 13 14:24 server1.stdout -rw-r--r-- 1 root root 1106206778 Mar 13 14:15 server1.stdout.1 ---8<--- Now I'll start logrotate with force and debug parameters: ---8<--- root@rhpatch:/u02/bosse/logg$ /usr/sbin/logrotate -d -f /etc/logrotate.d/server1.stdout reading config file /etc/logrotate.d/server1.stdout reading config info for /u02/bosse/logg/server1.stdout Handling 1 logs rotating pattern: /u02/bosse/logg/server1.stdout forced from command line (6 rotations) empty log files are not rotated, old logs are removed considering log /u02/bosse/logg/server1.stdout log needs rotating rotating log /u02/bosse/logg/server1.stdout, log->rotateCount is 6 renaming /u02/bosse/logg/server1.stdout.6 to /u02/bosse/logg/server1.stdout.7 (rotatecount 6, logstart 1, i 6), renaming /u02/bosse/logg/server1.stdout.5 to /u02/bosse/logg/server1.stdout.6 (rotatecount 6, logstart 1, i 5), renaming /u02/bosse/logg/server1.stdout.4 to /u02/bosse/logg/server1.stdout.5 (rotatecount 6, logstart 1, i 4), renaming /u02/bosse/logg/server1.stdout.3 to /u02/bosse/logg/server1.stdout.4 (rotatecount 6, logstart 1, i 3), renaming /u02/bosse/logg/server1.stdout.2 to /u02/bosse/logg/server1.stdout.3 (rotatecount 6, logstart 1, i 2), renaming /u02/bosse/logg/server1.stdout.1 to /u02/bosse/logg/server1.stdout.2 (rotatecount 6, logstart 1, i 1), renaming /u02/bosse/logg/server1.stdout.0 to /u02/bosse/logg/server1.stdout.1 (rotatecount 6, logstart 1, i 0), copying /u02/bosse/logg/server1.stdout to /u02/bosse/logg/server1.stdout.1 truncating /u02/bosse/logg/server1.stdout removing old log /u02/bosse/logg/server1.stdout.7 ---8<--- As you can see there has been no change to the log directory, even though the debug messages tells me otherwise: ---8<--- root@rhpatch:/u02/bosse/logg$ ls -l total 2207868 -rw-r--r-- 1 root root 1152430080 Mar 13 14:24 server1.stdout -rw-r--r-- 1 root root 1106206778 Mar 13 14:15 server1.stdout.1 ---8<--- If I try without the debug (-d) parameter, things get much better: ---8<--- root@rhpatch:/u02/bosse/logg$ /usr/sbin/logrotate -f /etc/logrotate.d/server1.stdout root@rhpatch:/u02/bosse/logg$ ls -l total 2207868 -rw-r--r-- 1 root root 0 Mar 13 14:30 server1.stdout -rw-r--r-- 1 root root 1152430080 Mar 13 14:30 server1.stdout.1 -rw-r--r-- 1 root root 1106206778 Mar 13 14:15 server1.stdout.2 ---8<--- Actual results: --------------- Debug messages informing about expected logrotate activities, but no action is performed. Expected results: ----------------- Debug messages informing about expected logrotate activities, with actions being performed. Additional info: ---------------- Workaround is to not use debug parameter.
$man logrotate ... -d Turns on debug mode and implies -v. In debug mode, no changes will be made to the logs or to the logrotate state file. ...