Logrotate, is this a proper config for what I want to do?

Posted on

Logrotate, is this a proper config for what I want to do? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, logrotate, , , .

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.

Solution :

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)

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.

Leave a Reply

Your email address will not be published. Required fields are marked *