Author Topic: Apache log file too large  (Read 4750 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Apache log file too large
« on: April 25, 2021, 01:12:03 AM »
I found that the apache log file is too large, how to clear the log? how to make the apache log save a file every day by date?

/usr/local/apache/domlogs/mydomain.log-5.1GB
/usr/local/apache/logs/access_log-4.5GB
/usr/local/apache/logs/suphp_log-3.6GB

I changed suphp_log to suphp_log-, and then changed it to suphp_log. Now the modification time of suphp_log has not changed for a long time, indicating that the system no longer uses suphp_log. How do I fix it?
« Last Edit: April 25, 2021, 01:22:47 AM by gailclark80 »

Offline
*
Re: Apache log file too large
« Reply #1 on: April 25, 2021, 12:34:41 PM »
setup logorotate for dom logs and apache logs


/usr/local/apache/domlogs/*.log   /usr/local/apache/logs/*.log  /usr/local/apache/logs/*_log  {
    daily
    missingok
    rotate 30
    compress
    delaycompress
    notifempty
    create 640 root adm
    sharedscripts
    postrotate
   /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
        /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

thiis will make smaler flies that you can remove after you dont need - keeping last 20-30 days if needed

Offline
*
Re: Apache log file too large
« Reply #2 on: March 07, 2022, 10:46:50 PM »
Hi all,
I noticed that by deleting the logs in "/usr/local/apache/domlogs/", the statistics application "goaccess" does not show the statistics.
My question is: is there a way to clear these logs without goaccess stopping working?
for example awstats reads the logs every night, and the rotate doesn't bother him and I wanted to understand if there was the possibility of doing the same thing with goaccess as well.

I don't want to leave too large logs on the system without being able to rotate them, but I also don't want an application like goaccess to stop working.

Does anyone have a solution?
Thanks
Claudio