You are not logged in.
Pages: 1
uname -a
Linux CLS 3.11.6-1-ARCH #1 SMP PREEMPT Fri Oct 18 23:22:36 CEST 2013 x86_64 GNU/Linuxlogrotate --version
logrotate 3.8.7cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# restrict maximum size of log files
size 10M
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# Logs are moved into directory for rotation
# olddir /var/log/archive
# Ignore pacman saved files
tabooext + .pacorig .pacnew .pacsave
# Arch packages drop log rotation information into this directory
include /etc/logrotate.d
/var/log/wtmp {
    monthly
    create 0664 root utmp
	minsize 1M
    rotate 1
}
/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}cat /etc/logrotate.d/test
/var/log/test.log {
    missingok
    rotate 2
}ls -l /var/log/test.log
-rw------- 1 root root 1104925 Oct 23 16:16 test.loglogrotate -fd /etc/logrotate.d/test
reading config file /etc/logrotate.d/test
Handling 1 logs
rotating pattern:  /var/log/test.log    forced from command line (2 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/test.log
  log needs rotating
rotating log /var/log/test.log, log->rotateCount is 2
dateext suffix '-20131023'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/test.log.2 to /var/log/test.log.3 (rotatecount 2, logstart 1, i 2),
renaming /var/log/test.log.1 to /var/log/test.log.2 (rotatecount 2, logstart 1, i 1),
renaming /var/log/test.log.0 to /var/log/test.log.1 (rotatecount 2, logstart 1, i 0),
renaming /var/log/test.log to /var/log/test.log.1
removing old log /var/log/test.log.3
error:  error opening /var/log/test.log.3:  No such file or directoryls -l /var/log/test.log*
-rw------- 1 root root 1104925 Oct 23 16:16 test.logAs you can see, logrotate aborts and the file is not rotated. I assumed the problem was with the missingok option so I tested this possiblity as shown below.
touch test.log.0 test.log.1 test.log.2 test.log.3
ls -l test.log*
-rw------- 1 root root 1104925 Oct 23 16:16 test.log
-rw------- 1 root root       0 Oct 23 17:37 test.log.0
-rw------- 1 root root       0 Oct 23 17:37 test.log.1
-rw------- 1 root root       0 Oct 23 17:37 test.log.2
-rw------- 1 root root       0 Oct 23 17:37 test.log.3
logrotate -fd /etc/logrotate.d/test
reading config file /etc/logrotate.d/test
Handling 1 logs
rotating pattern:  /var/log/test.log    forced from command line (2 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/test.log
  log needs rotating
rotating log /var/log/test.log, log->rotateCount is 2
dateext suffix '-20131023'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/test.log.2 to /var/log/test.log.3 (rotatecount 2, logstart 1, i 2),
renaming /var/log/test.log.1 to /var/log/test.log.2 (rotatecount 2, logstart 1, i 1),
renaming /var/log/test.log.0 to /var/log/test.log.1 (rotatecount 2, logstart 1, i 0),
renaming /var/log/test.log to /var/log/test.log.1
removing old log /var/log/test.log.3
ls -l test.log*
-rw------- 1 root root 1104925 Oct 23 16:16 test.log
-rw------- 1 root root       0 Oct 23 17:37 test.log.0
-rw------- 1 root root       0 Oct 23 17:37 test.log.1
-rw------- 1 root root       0 Oct 23 17:37 test.log.2
-rw------- 1 root root       0 Oct 23 17:37 test.log.3No error but the file has not been rotated.
Anyone have ideas on what may be wrong.  The last time my logs were rotated was April.
Last edited by medicineman (2013-10-23 23:24:43)
Offline
Are you running logrotate as root? Usually, it is run as a cron job with root permissions.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
I noticed last night that the logs have not been rotated. For the moment, I am testing as root. It normally runs as a cron job.
Offline
It seems my state file (/var/lib/logrotate.status) was corrupted. I deleted this file and then did "logrotate -f /etc/logrotate.d/syslog-ng". The state file was recreated and now everything is working again. No idea how the file became corrupted, though.
Offline
Pages: 1