Setting up awstats for multiple virtual host logs

I only just realized recently that my apache2 config was outputting logs for my main domain into access.log, and all other virtual hosts into other_vhosts_access.log. As a result, awstats was not picking up hits to the majority of my sites.

To set up awstats to produce stats for each of my stats was relatively easy:

  • Config each virtual host in your apache2.conf to have it’s own CustomLog directive:
    <code><br />
    &lt;VirtualHost *:80&gt;<br />
    ServerAdmin example@example.com<br />
    DocumentRoot /var/www/html/example<br />
    ServerName www.example.com<br />
    DirectoryIndex index.jsp index.html<br />
    CustomLog /var/log/apache2/access_example.log combined<br />
    &lt;/VirtualHost&gt;<br />
    </code></p>
    <li>Copy your /etc/awstats/awstats.conf to awstats_example.conf – one per each domain where example is the domain name
    <li>Edit each awstats.conf and change the log entry to point to the log file you added in the apache2.conf above, change the DataDir to be /var/awstats/example, and SiteDomain to e.g. example.com
    <li>Create new subdirs for each DataDir in /var/awstats
    <li>Run the stats collection manually to check working:
    <pre><code>
    sudo /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -update -config=example.com
    </code>

  • Update your cron entry to schedule the log processing, e.g. in /etc/cron.d/awstats:
    <code>
    0,30 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats_example.com.conf -a -r 
    /var/log/apache/access_example.log ] &#038;& /usr/lib/cgi-bin/awstats.pl -config=example.com -update >/dev/null
    </code>
  • Add one line for each of the domains you need to collect log stats for. Done!

To access the stats for each of the domains, use the awstats config name passes as a param in the URL:

<code>
http://www.example.com/awstats/awstats.pl?config=example.com
</code>

Google working on Chrome based OS

It’s been long rumored that Google were working on an OS, and maybe the launch of the Google phones through people of the scent slightly. But it was true, Google announced last night they are building a lightweight OS based on their Linux and their Chrome browser as the basis, supported by the raft of other apps/technologies they have been slowly rolling out.

The OS will be targeted to netbook type devices, and will run the majority of apps from the cloud, like Google Docs etc, rather than on the machine itself, but with Google Gears providing offline capability they’ve got their bases covered.

Funny how Microsoft has tried this approach twice and never managed to make it stick – first with the Hailstorm initiative, hosting apps and data online, and secondly with their half-hearted live.com attempt that doesn’t seem to be going anywhere right now.

More details here.