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.

I started using logrotate a few days ago on a new server setup (actually three of them). My config is as follows.

/var/www/mywebsite.com/logs/*.log {
    rotate 14
    daily
    dateext
    compress
    delaycompress
    sharedscripts
    postrotate
        /usr/sbin/apache2ctl graceful > /dev/null
    endscript
}

Problem is that this is putting several days of logs into the same file. For example, I've currently got a file called access.log-20121005 which has logs for Oct 3rd, Oct 4th and Oct 5th in it. Is that proper behaviour? What I want for it to do is to create one logfile for each day and keep 14 days of logs.

Any help appreciated, thanks.

share|improve this question

migrated from stackoverflow.com Oct 17 '12 at 23:01

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

Oct 3rd, Oct 4th and Oct 5th in it. Is that proper behaviour?

Why will you splitt the log every day? There are lot's of analysing tools to query your whishes ... on my productive system the log-rotate is monthly (on the high performed systems weekly) ...

A short overview about analysing-tools you find here http://robert.boeck-horn.de/logfile-analyzer.php (Overview in german, landing pages english)

share|improve this answer
1  
Doesn't matter my reasons, I just want to know if it's proper configuration and - if not - how would I do it? –  Felthragar Oct 5 '12 at 10:42
add comment
up vote 0 down vote accepted

Turns out it was working correctly. The reason it put three days is because it had been running for two days prior and just put everything in the first log. Appears to be splitting correctly now, apart from the fact that it's running at 6am or something so we get six hours worth of logs in the wrong date, but that's fine.

share|improve this answer
add comment

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.