From owner-freebsd-isp@FreeBSD.ORG Wed Feb 7 15:17:55 2007 Return-Path: X-Original-To: freebsd-isp@freebsd.org Delivered-To: freebsd-isp@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E04E16A403 for ; Wed, 7 Feb 2007 15:17:55 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.freebsd.org (Postfix) with ESMTP id 35A1913C481 for ; Wed, 7 Feb 2007 15:17:54 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from localhost (jn@ns1 [69.55.238.237]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id l17EcIAE048661; Wed, 7 Feb 2007 09:38:19 -0500 (EST) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-isp@freebsd.org Date: Wed, 7 Feb 2007 09:34:33 -0500 User-Agent: KMail/1.9.5 References: <20070207130614.GA15328@fupp.net> In-Reply-To: <20070207130614.GA15328@fupp.net> X-Face: #X5#Y*q>F:]zT!DegL3z5Xo'^MN[$8k\[4^3rN~wm=s=Uw(sW}R?3b^*f1Wu*.<=?utf-8?q?of=5F4NrS=0A=09P*M/9CpxDo!D6?=)IY1w<9B1jB; tBQf[RU-R<,I)e"$q7N7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702070934.34074.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: Anders Nordby Subject: Re: Per virtualhost bandwidth/hitrate statistics for Apache X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Feb 2007 15:17:55 -0000 On Wednesday 07 February 2007 08:06, Anders Nordby wrote: > I just wonder if anyone has any good hints about software to use (Apache > module?) for fetching per-virtualhost statistics about bandwidth usage > and hitrates (hits per second) from Apache. I've been using mod_watch > for a while, to graph this with MRTG, but it's discontinued it seems. > > What do people use to measure statistics per virtualhost? I use Apache's logrotate and a separate log directory for each virtualhost. I have a script that runs from cron every day that runs the logs through webalizer and then cleans up logs older than a specified number of days. In fact (since I'm feeling like sharing), here it is: #!/bin/sh for path in `cat /usr/local/scripts/logpaths.txt` ; do for log in `find ${path} -name access\* | sort -n` ; do if [ -r ${path}/hostname.txt ]; then host=`cat ${path}/hostname.txt` /usr/local/bin/webalizer -Q -p -n ${host} \ -o ${path} ${log} else /usr/local/bin/webalizer -Q -p -o ${path} ${log} fi done find ${path} -name \*.log\* ! -newermt '1 month ago' -delete done The script depends on the existence of a "logpaths.txt" file, which contains a list of directories to scan, one per line. It also supports an optional "hostname.txt" for each directory so webalizer can use the right one in the title of its reports. Webalizer output is stored in the log directory but that could easily be changed. The output is plain HTML, so you can publish it on a (presumably private) webserver somewhere. Since I give certain clients access to their reports I use webmin for this. However I just point webmin to a dummy file within each log directory and don't let it actually run webalizer (since my script already takes care of that). So just the "View report" button works, but it gets the job done. JN