Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 231980 - Logrotate does not rotate logs when using debug (-d) force (-f)
Summary: Logrotate does not rotate logs when using debug (-d) force (-f)
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: logrotate
Version: 3.8
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-13 13:35 UTC by Bosse Klykken
Modified: 2007-11-17 01:14 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-15 13:27:56 UTC


Attachments (Terms of Use)

Description Bosse Klykken 2007-03-13 13:35:54 UTC
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 13:27:56 UTC
$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.