Compress Apache Domain Logs

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__ __{__
    __rotate 2__
    __/bin/____kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null ||__ __true__
  7. Save the file in vi wq

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