I need to change the log retention for apache, currently is seems to be running on the default from logrotate.conf which is weekly. It creates 'access_log.1' 'access_log.2' and so on for each week. The problem is it deletes the last log file every week, 'access_log.5', I need the logs to keep going infinitely instead of the last log being deleted every week. It seems to be running on the default value from logrotate.conf - I don't want to change the default values held in that file, so I assume there is a way to change the retention using the /etc/logrotate.d/httpd file?

the contents are as follows:

/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

what can I add/change to stop the last log being deleted every week?

link|improve this question
feedback

1 Answer

You would need to add the rotate {value} option to tell logrotate how many copies to keep. The below will keep 52 copies.

/var/log/httpd/*log {
    missingok
    rotate 52
    notifempty
    sharedscripts
    postrotate
    /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}
link|improve this answer
Is there a value to make it infinite? ie. '0' or would I be better off setting it to 50 billion? – vittocia Mar 15 '10 at 1:23
You could also use something like cronolog. serverfault.com/questions/20337/cronolog-vs-logrotate serverfault.com/questions/41349/… – Zoredache Mar 15 '10 at 5:55
feedback

Your Answer

 
or
required, but never shown