Hello,
I see the 50% of my disk files are almost the Apache domlogs. How can I disable/enable them when I need it?
Thanks!
If you don't need to save them, first start by truncating your apache error & access logs to zero bytes:
truncate -s0 /usr/local/apache/domlogs/*.error.log
truncate -s0 /usr/local/apache/domlogs/*.log
Also consider doing the same if you are sure you don't need your CWP access/error logs (for security auditing/troubleshooting):
truncate -s0 /usr/local/cwpsrv/logs/*_log
Also, look under /usr/local/cwp/php71/var/log/
To automatically rotate the logs, add a configuration to logrotate for apache logs. Put this code into /etc/logrotate.d/httpd (or use File Management > Logrotate Manager to create it):
/usr/local/apache/domlogs/*log {
missingok
notifempty
sharedscripts
daily
rotate 7
postrotate
/bin/systemctl reload httpd.service > /var/log/httpd-rotate.log 2>&1 || true
endscript
compress
}
Will that STOP the logs? These files are really huge.
What I am suggesting is that you truncate them to 0 bytes -- then start fresh with log rotation (keeping only 7 copies) that are compressed. So it won't build up like that again -- much more manageable but still there for reference in case of an error or security breach.
That configuration to logrotate for apache logs will be lost after CWP updates?
It shouldn't; it's a new file you create in the /etc/logrotate.d directory which is a CentOS system directory.
CWP has an interface for creating/managing logrotate jobs under File Management > Logrotate Manager.
ok that works. Do I have to configure extra cron job for that also? thanks.
No, logrotate already happens -- you're just adding a job to its task list. No additional cronjob necessary. You'll find that the roundcube and dovecot IMAP logs also need to be rotated, or they too balloon to become HUGE.
Thanks.