Apache daily logrotate

log-fileslogrotate

I want to create daily logs, but there's a small problem. Logs aren't being created for each day, rather they contain the previous log files. Here's my current setup, how can I change it so it only create a log file for each day?

I edit the following file : /etc/logrotate.d/httpd

I'm using a control panel called Zadmin so I included its log path as a second dir.

I'm using CentOS 6.5 64 bit.

/var/log/httpd/*log /var/sentora/logs/domains/zadmin/*.log {
    missingok
    rotate 4000000
    daily
    notifempty
    sharedscripts
    postrotate
    /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

Best Answer

Following on to Brian's answer, I'm a big fan of cronolog, which does pretty much exactly what you're going for:

CustomLog "|/usr/sbin/cronolog /var/log/httpd/%Y/%m/%Y-%m-%d-access.log" combined
ErrorLog "|/usr/sbin/cronolog /var/log/httpd/%Y/%m/%Y-%m-%d-error.log"

yum install cronolog will get you cronolog on Cent6.