Back to Applications

How To Use AWStats With Multiple Domains In Site Manager


This article is for Site Manager, please determine your account type with this guide.

AWStats is a powerful logging application capable of tracking statistics for multiple domains at the same time. By default WestHost only has it set up to log for the entire account, lumping all the statistics together under the primary domain.

If you would prefer to see the statistics for each of your domains individually it will require some customization to your account. Because it is custom, technical support cannot make the changes for you, but we have provided this step-by-step guide on what needs to be changed for your convenience.

Before we begin, it is important to note AWStats simply parses the Apache logs, access, error, and SSL. So for AWStats to separate the statistics, we need to separate the logs.


Separate Logs for Addon Domains

You will need to modify the file found at /etc/httpd/conf/httpd.conf. You can do this via the File Manager in your Site Manager, or you can download the file and open it in a generic text editor like NotePad or TextEdit. You can also view the file via any Linux text editor, vi, vim, pico, nano, etc. that you like.

In that file you will want to go all the way to the bottom of the file, looking for something like this:

apacheconf.jpg


There should be similar tags for each of the domains you want to track statistics for. If not then the domains are all pointed to the default directory and show the same content as the primary domain name. If this is the case their statistics will be the same so you will have nothing to split up. Inside the “VirtualHost” tags for each domain you want to track separate statistics for you will need to add the following line, just above the “” line, changing “secondary domain” for the actual domain name:

CustomLog logs/secondaryddomain_access_log combined

That line will tell the Apache webserver to create a custom log file for that domain in the /var/log/httpd/ directory. It should look like this:

apacheconf0.jpg


Once these changes have been made you will need to save them. If you downloaded the httpd.conf file, you will need to upload it now, overwriting the existing file. Please note that you should always backup your original system files before making changes/overwrites.

Once the file has been uploaded you will need to restart Apache. To do this you can use the Restart Account function of the Site Manager, which will reboot the entire account. If you are working on your account via SSH you can just use the command ‘apachectl graceful’, without the quotes. This will start Apache logging the statistics for the additional domains you wanted.

Proper Log Rotation


Now, one thing to keep in mind here is that this log is not set to rotate the same way the log for your primary domain is. While this might not seem like a problem, it will cause the log to grow to an unmanageable size, and it will also cause AWStats to not update properly and automatically. To fix this, you will need to edit the /etc/logrotate.conf file. In the file you will need to look for the line listing the log files, for example below:

apacheconf1.jpg


You will need to modify this line so it contains the name of the new log file we just told Apache to create. Here is your example:

apacheconf2.jpg


Then you will save the file just as you did the httpd.conf file.

AWStats and the New Log File(s)


Now that the log file(s) have been created, we will need to tell AWStats to parse them. To do that you will need to go to the /etc/awstats directory. Before making changes please look at the directory so you are familiar with its appearance before your changes. It should look like this:

awstatsconf.jpg


To make this as simple as possible just take a copy of that file and name it “awstats.secondarydomain.com”, replacing “secondarydomain.com” with the domain name you want to track the statistics for. This is the file we will be editing.

In the awstats.secondarydomain.com file, you will need to look for a line that looks something like this:

awstats0.jpg


As you can see, it contains the file paths for your primary domain. You will need to change it so it looks something like this:

awstats1.jpg


Next, we need to change the SiteDomain and the HostAliases directives for the new domain name. These directives look similar to this, by default:

awstatsconf0.jpg


And

awstatsconf1.jpg


These will both need to change to reflect the domain name of the site you want to track the statistics for, similar to this:

awstatsconf2.jpg


And

awstatsconf3.jpg


You will also need to look for the AllowToUpdateStatsFromBrowser (line 237) entry which will look like this by default. Update it from a '0' to a '1' to allow in-browser updating:

awstatsconf4.jpg


Here is the line after the said change:

awstatsconf5.jpg


Once these changes have been made, save and upload (if you downloaded the file). There is nothing to restart here, so double-check that everything was done properly.

Test Changes in Browser


To check what was just done, go to the site you just set this up for, so there is something in the access_log. You will then need to go to the AWStats web interface. Here are example URLs to utilize. Be sure to replace the domain entries with your actual domain names:

http://primarydomain.com/awstats/awstats.pl?config=primarydomain.com

You will notice this will have the old statistics, but will not have the new visit you just made to the secondary domain. To see this you will need to go to the separate configuration for the secondary domain. Again, replace the domain entries with your actual domain name:

http://primarydomain.com/awstats/awstats.pl?config=secondarydomain.com

The visit will not initially appear in this second URL. You need to process the log file into AWStats. The log files are not processed in real-time, but rather on a set schedule. You can force AWStats to parse the log file by clicking the “Update Now” link at the top of the page. Now you should see all the visits to this site since you created the new log file.

As long as you see the new visits you are set and ready to go. If not there may have been a step missed, and you may need to go back through these instructions.

that this is a customization of the software provided to you, and not within the scope of Technical Support. If you have any questions about AWStats or your account, our Technical Support team may be able to point you in the right direction.



Related Articles

How To Activate SSL In OSCommerce
How To Reset My OSCommerce Password
What Is OSCommerce
How To Reset My Drupal Password
What Is Drupal

Can’t Find what you need?

No worries, Our experts are here to help.