Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Bandwidth/traffic stats
PostPosted: Mon Sep 26, 2005 7:02 pm 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
So... im corious to know.. im running a few websites in a shared hosting kind of format for some people, inwhich im running apache2/php/jsp and mail/ftp.

Some of them are interested to know what and/or howmuch they have transfered from there site, is there any easy way of tracking this kind of information?

the sites are all virtual hosts in apache2.. so i was thinking is there any kind of traffic accounting module for apache?

cheers
Nathan


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2005 7:06 pm 
Offline
Senior Member

Joined: Fri Aug 06, 2004 5:49 pm
Posts: 158
AWStats and Webalizer do what you're looking for.


Top
   
 Post subject:
PostPosted: Wed Oct 12, 2005 1:23 am 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
these packages seemed quite interesting to configure.. anyone have a really decent tutorial for setting them up with virtual hosting in place?

cheers
NF


Top
   
 Post subject:
PostPosted: Wed Oct 12, 2005 3:16 am 
Offline
Senior Member

Joined: Sun Jul 20, 2003 8:29 am
Posts: 100
Website: http://www.ipo-australia.com
Location: Tropical Queensland, Australia
I use the following, & process using webalizer:

ServerRoot "/www"
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined


<VirtualHost 99.99.99.99>
ServerName www.mysite.com
ServerAlias mysite.com
Options +Indexes
ServerAdmin webmaster@mysite.com
DocumentRoot /home/mysite/www
CustomLog logs/access_log combined
# puts log file in /www/logs/access_log
</VirtualHost>


Top
   
 Post subject:
PostPosted: Wed Oct 12, 2005 7:53 pm 
Offline
Senior Member

Joined: Fri Aug 06, 2004 5:49 pm
Posts: 158
I use AWStats along with separate log files for all my vhosts. You should be able to do it with one log file, but if you miss a configuration option, you're going to get vhost statistics mixed in with other vhosts. There is a big drawback to my setup though. If you have lots of vhosts, this isn't going to work for you, Apache will lock up opening too many file descriptors on log files. With fair warning out of the way...

In Apache config, if it isn't already setup, you'll want to let Apache know to not log virtual hosts to your main log file and also a logformat describing the format to log to for AWStats (my config uses the standard NCSA combined log format, it might already be configured in your Apache config):

Code:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog logs/access_log combined env=!VLOG

Then in each of your virtualhost definitions (depending on where you want to see your logs):

Code:
CustomLog logs/access_log_myvhost combined


The rest of the setup is croning AWStats to run whenever you want stats updated (the more often the better since AWStats knows where it left off in the log files, and can spread out it's work load, especially if you enable DNS lookups, not advisable on high traffic sites).

In your AWStats config files, the variables you'll want to make sure you've set are:

Code:
LogFile="/var/log/apache2/access_log_myvhost"
LogType=W
# Here's where that NCSA standard comes in handy, you
# don't have to specify you're entire custom format since
# AWStats has a setting for the standard.
LogFormat=1
SiteDomain="mydomain.tld"


So long as you have those ones set right, you should be fine, but it's always a good idea to go through the entire config file of course. The important settings should be right up top.


Top
   
 Post subject:
PostPosted: Thu Oct 13, 2005 9:25 am 
Offline
Senior Member
User avatar

Joined: Wed Mar 17, 2004 12:35 am
Posts: 118
Website: http://www.necrobones.com/
Location: Sterling, VA
tierra wrote:
I use AWStats along with separate log files for all my vhosts. You should be able to do it with one log file, but if you miss a configuration option, you're going to get vhost statistics mixed in with other vhosts. There is a big drawback to my setup though. If you have lots of vhosts, this isn't going to work for you, Apache will lock up opening too many file descriptors on log files. With fair warning out of the way...


Yeah, I've run into that before. The good news is that it can handle several hundred open files. If you have an access log, error log, and SSL log for each vhost, you can probably get upwards of about a hundred domains or so before it crashes and burns.

If you only use maybe 20 vhosts, there's no problem at all.

_________________
----
Ed/Bones.


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2005 9:23 pm 
Offline
Senior Member

Joined: Fri Aug 06, 2004 5:49 pm
Posts: 158
Well, part of the problem is when you get concurrent connections with the same vhost, you can have a few threads with the same vhost log file open, so you get into some multiplication problems at that point being that's where it starts to have real problems even if you only had 20 vhosts, but they have a lot more traffic. At least that's been my understanding of it, someone correct me if I'm wrong.

That's also part of the reason I kill logging to the main access log file as well since it would double the file descriptors open with both a separate vhost log file and main access log file.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group