Loading...
 

How can I compress my apache domain logs on a cpanel server?

WHM/Cpanel Log Compression

Before setting up compression we have to make sure cpanel parses your log data for the statistics pages of WHM/Cpanel so you dont have any lost data.

1. Login to your server via SSH as normal, then switch user to Root.
su - root
2. Run the log parser for cpanel to ensure you have updated data
/scripts/runlogsnow
3. Change directories to /etc/logrotate.d
cd /etc/logrotate.d
4. Copy the httpd logrotate script to a new file called 'domlogs'
cp httpd domlogs
5. Edit the newly created domlogs script
vi domlogs
6. Add the following;
/usr/local/apache/logs/*.com /usr/local/apache/logs/*.org /usr/local/apache/logs/*.net {
missingok
notifempty
size=200M
rotate 2
compress
sharedscripts
postrotate
/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
7. Save the file in vi
:wq

You will now have logrotate compress your domain logs and restart apache every time it runs.

Show php error messages