Control Web Panel
WebPanel => Apache => Topic started by: kalybg on August 16, 2025, 12:24:38 PM
-
Hello,
How can I limit the size of the error log in /usr/local/apache/domlogs/ ?
I want to set it to no more than 100 MB.
P.S. I have a compromised WordPress site for a client and in 12 hours it made my error log 155 GB. This stopped my server and even access to it. This is frivolous from a security point of view and is complete nonsense.
Please, if anyone has a normal solution, share it.
Thanks in advance.
(https://i.ibb.co/mr5m4nPB/47464354353.jpg)
-
Enable logrotate to keep your logs to a manageable size.
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
}