I have the following configuration that is not working:

1) Using rsyslog with Centos 5. 2) Inside /etc/logrotate.d I have the file sj-piers-logs.

SJ-PIERS-LOGS:

/syslogrep/sjpiers-logs/0* {
weekly
missingok
notifempty
dateext
copytruncate
compress
olddir /syslogbackup/sjpiers-logs/backup
rotate 96
}

4) logrotate.conf have the default configuration:

LOGROTATE.CONF

weekly
rotate 4
create
include /etc/logrotate.d
/var/log/wtmp {
    monthly
    minsize 1M
    create 0664 root utmp
    rotate 1
}

5) Syslogs are sent by network devices to /syslogrep. I want to rotate the log file, compress and move it to /syslogbackup.

I was told that the error reside in the use of wildcards in sj-piers-logs file but it seems that I can use them according the the man page. What I'm doing wrong?

link|improve this question

You say "not working" but you don't say exactly how. What does happen? What errors do you get? – Dennis Williamson Aug 24 '09 at 15:57
Also you have 1), 2), 4) and 5). Where's 3)? – Dennis Williamson Aug 24 '09 at 16:05
Kyle, Nothing is happening the log files are not rotated and moved to /syslogbackup Dennis, Sorry about the typo. syslogrep and syslogbackup and everything inside have drwxrwxrwx but that is when they are listed as root. As a separate note using samba I can not read /syslogrep files from windows machine. hayalci: I run the command you gave me and it returned an error: error: sjpiers-logs:12 olddir /syslogbackup/sjpiers-logs/backup and log file /syslogrep/sjpiers-logs/00-emerg are on different devices. Each is mounted in different partitions. – 3D1L Aug 25 '09 at 16:35
well, you have your answer then. You should keep old logs and current ones under the same partition to achieve atomic "mv" capability. – hayalci Aug 25 '09 at 19:04
feedback

2 Answers

up vote 2 down vote accepted

Try a test run with

 logrotate -f -d /etc/logrotate.conf

It will provide you with an error message, or you can further investigate the logrotate configuration.

link|improve this answer
feedback

One potential problem is if your olddir doesn't exist or has the wrong permissions. It will not be handled by missingok.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.