Re: Combined virtual apache logs
Thursday, October 6, 2005, 12:04:26, Andy Smith wrote:
AS> On Thu, Oct 06, 2005 at 11:32:39AM +0200, Marek Podmaka wrote:
>> I also have different combined log for every virtualhost in Apache
>> (more than 500). I run both webalizer and awstats and have a script
>> that parses awstats "cache" files and write bandwidth usage per
>> vhost to mysql. Then I have php script which provides me info about
>> which vhost transferred most GB and monthly total over all vhosts.
AS> Hi Marek, are you willing to share those scripts?
Of course, but you will need to alter them to suit your config. I
have all awstats files in /var/cache/vhost/, so for example awstats
cache files for every month of www2.domain.com is in dir
I run awstats few times a day and after it is run for every vhost, I
run awstats-db.pl which makes list of all files in
/var/cache/awstats and processes only those for current month. I
fact it is heavily modified version of script I found on
awstats.org. In file sql.in there is CREATE statement for mysql
table. One row per vhost+month containing total traffic (I sum
"Viewed traffic" with "Not viewed traffic", because for awstats also
HTTP 206 is not viewed traffic).
awstats-all.php displayes 3 tables - one with total traffic per
vhost, second with this month's traffic per vhost and third is
summary of total traffic of all vhosts per month.
You can download it here: