Logs do not rotate

My problem: Both access and error logs do not rotate any more and get really large.

They are located here: /srv/www/+vHost name here+/logs/

Configuration seems to be here:
/etc/logrotate.conf => looks OK, including "size 10M" to avoid large files
(/etc/logrotate.d => is empty)

manually starting logrotate (logrotate -v /etc/logrotate.conf)
only results in adding the current date to the log file name,
but there is no new empty log file created.
Instead, new log entries are still added to the renamed log files.

I tried to replace "create" inside the conf file with "copytruncate".
This time, the log file name is not changed (no date added), but there is no copy made
of the file and it is not emptied.

I hope this is the right forum to post to; I haven't set up the server myself and dive into the topic for the first time. General manuals did not help so far, unfortunately...
I'm not afraid to do further researches myself, but have no idea where to look for...
Thanks for any hints! :slight_smile:

P.S.: The web server is running on
Amazon Linux AMI 2014.09.2 x86_64 HVM EBS
(httpd-2.2.31-1.6.amzn1.x86_64)

Can you post the sanitized configuration file?

It is difficult to guess by your statement of /etc/logrotate.conf seems OK.

---------- Post updated at 02:49 PM ---------- Previous update was at 02:46 PM ----------

Still logging to old files? You may need to reload the logger (syslog/httpd) service.

Sure, thanks for having a look!

weekly

rotate 4

# create # removed 
copytruncate

dateext

include /etc/logrotate.d

size 20M

/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

Hello,

This looks like the default configuration file.

Your web server probably has a location specified for the vhost log. Check if there is a httpd (or similar) file under logrotate.d. My guess is your logrotate might be setup to rotate logs under /var/log/httpd, but not under /srv.

1 Like

Indeed, thanks a lot! I wasn't aware that this configuration could be located somewhere else. (SinceI have almost no idea of Linux in general.)

/var/log/httpd/*log /srv/www/*/logs/*log {
        daily
        rotate 7
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

I will try to make changes here and see what happens.
Thanks again!