Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

From logrotate manpage.

It will not modify a log more than once in one day unless the criterion for that log is based on the log's size

According to the man page, logrotate should rotate file if the configuration is based on logs size. But, my file is not getting even if the filesize if greater than 100k.

Can somebody point out what is the issue.

My configuration

/home/jetech/work/lampstack-5.3.9-0/apache2/logs/access_log  {
    copytruncate
    compress
#    dateext
    rotate 365
    size 100k
    olddir /home/jetech/work/lampstack-5.3.9-0/apache2/old_logs
    notifempty
    nomail
    missingok
}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

How do you know the file is not getting rotated?

On a Debian 6 Linode I have, in the default configuration logrotate was only scheduled by cron to run once per day, and at a very odd time at that. If only run once per day, naturally it'll only have one opportunity per day to look at the configuration, do the comparisons and perform the rotations required.

So, are you sure you're actually running your logrotate? Might want to check your /etc/cron* and /etc/cron*/* to see when and how often logrotate is scheduled to run.

For example, if logrotate script is present in /etc/cron.daily, then you may want to move it to /etc/cron.hourly, or, if hourly is not good enough, create a file in /etc/cron.d/ with the following content, to run logrotate every 10 minutes:

*/10  *  *  *  *   root    /usr/sbin/logrotate /etc/logrotate.conf
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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