Merging SSL and non-SSL Plesk logs

Submitted by George Moses on Tue, 2011-01-04 20:50

Plesk keeps separate logfiles for SSL (https) web traffic and non-SSL (http) web traffic. This is no issue for the majority of websites who don't use a SSL certificate. For some, mostly webshops in my experience, this is a nuisance because web statistics is split along two different (AWstats) reports. These reports can't be simply added together because some users switch at some point in visiting the webshop from a non-SSL connection to a SSL connection. This usually happens during checkout. Adding the (unique) user count would lead to a double count of these visitors ordering in the webshop.

Fortunately, merging the logfiles is fairly easy, by manually adding some Apache configuration. Basically, all you have to do is define an extra logging for the SSL-version of the domain, pointing it to the logfile of the non-SSL version. This will add all the SSL-traffic to the non-SSL log, but also keeps the original SSL log and reports.

Example merging SSL and non-SSL Plesk logfiles

For this example I'm using a SUSE 11 setup with Plesk 9.5. The Apache configuration files for the domain are stored in the file: /srv/www/vhosts/example.com/conf/vhost_ssl.conf. Redhat Linux and the like use the directory /var/www/vhosts/example.com/conf/. If the file doesn't exists, you'll have to add it manually. In this file you'll have to add the following lines:

CustomLog /srv/www/vhosts/example.com/statistics/logs/access_log plesklog
ErrorLog /srv/www/vhosts/example.com/statistics/logs/error_log

When you have created the configuration file, you'll have to regenerate the Plesk Apache config with the following command:

/usr/local/psa/admin/bin/websrvmng -a

After restarting Apache using rcapache2 restart or /etc/init.d/apache2 restart the webserver will log all visitors in one logfile and Plesk will consolidate all visitors in the non-SSL version of the webstatistics during it's nightly update round.