Bug 231980 - Logrotate does not rotate logs when using debug (-d) force (-f)
Logrotate does not rotate logs when using debug (-d) force (-f)
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: logrotate (Show other bugs)
3.8
All Linux
medium Severity low
: ---
: ---
Assigned To: Peter Vrabec
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-13 09:35 EDT by Bosse Klykken
Modified: 2007-11-16 20:14 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-03-15 09:27:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bosse Klykken 2007-03-13 09:35:54 EDT
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.
Comment 1 Peter Vrabec 2007-03-15 09:27:56 EDT
$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.
...

Note You need to log in before you can comment on or make changes to this bug.