Default location of logs

By default cpanel puts it’s log files in /usr/local/apache/domlogs/DOMAIN – these are split up by domain, however it can be difficult when troubleshooting to find out where the problem might lie.

Combined logs

Combining the logs can be done by a bash script, however it’s consuming and not realtime.  The trick is to edit the configuration to create a new apache log, this will hold all the information.  Just remember to configure your log-rotate too (another post in the future).

Edit your vhost.default file

The latest version of apache is 2.4 at this time, edit the file /var/cpanel/templates/apache2_4/vhost.default

Add the following just before the </Virtualhost> at the bottom

LogFormat “%V %a %l %u %t \”%r\” %s %b \”%{Referer}i\” \”%{User-agent}i\”” vcommon
CustomLog /usr/local/apache/logs/vhost-access_log vcommon

In order to keep the configuration you need to rebuild the conf



/sbin/service httpd restart

This gets it all working.

If you want to track SSL accesses you need to edit the ssl vhost.default configuration.  I opted not to as there is usually a limited number of SSL sites and they stand out more on normal monitoring.