[CentOS] how do I set up separate log files/AWstats instances for a virtual host web server?

Mon Dec 12 03:59:28 UTC 2005
John Hinton <webmaster at ew3d.com>

Ron Jones wrote:

> Hi all,
>
> I've configured my server to to host multiple sites on a single IP 
> address, when complete, there will be no more than 5-6 websites on the 
> server.  They are located in /home/</username//public_html.
>
> Now, I'd like to add Awstats to each site, but to keep things 
> separated, I'd like to set up the log files independently.  Can anyone 
> point me at a resource that will walk me through setting up & 
> configuring said log files per site (including subdomains)?
>

In each virtualhost section within your apache config file...

ErrorLog /home/<username>/logs/error_log
CustomLog /home/<username>/logs/access_log common

or

ErrorLog /home/<username>/logs/error_log
CustomLog /home/<username>/logs/access_log combined

which adds more detail, particularly in the referrer fields.. This is 
configurable in the httpd.conf file as well.

You MUST make sure the logs directory exists in the user's directory. If 
it isn't there, apache will not restart. If a user removes the 
directory, apache won't restart. There are some scripts, one which is 
part of Webmin, which will deal with this for you.

I normally add these lines after DocumentRoot and before directory 
options, but it really doesn't matter. Just don't put them within 
<directory> areas.

Best,
John Hinton