<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments for dave's not here...</title>
	<link>http://davelozier.com</link>
	<description></description>
	<pubDate>Wed, 07 Jan 2009 13:08:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>Comment on AWstats with Vlogger Rotation by Dave</title>
		<link>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-5</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 26 Oct 2008 17:40:05 +0000</pubDate>
		<guid>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-5</guid>
		<description>Hey Guy! Thank you for this script.

I've got some work to do this coming weekend with which this will make much easier.

Cheers :)</description>
		<content:encoded><![CDATA[<p>Hey Guy! Thank you for this script.</p>
<p>I&#8217;ve got some work to do this coming weekend with which this will make much easier.</p>
<p>Cheers <img src='http://davelozier.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AWstats with Vlogger Rotation by Guy Marcenac</title>
		<link>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-4</link>
		<dc:creator>Guy Marcenac</dc:creator>
		<pubDate>Sun, 26 Oct 2008 09:34:35 +0000</pubDate>
		<guid>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-4</guid>
		<description>Hello Dave,
Starting from your idea, I wrote a fully automated script creating a conf file for each of the vlogger directories and executing awstats for each site found.
I dont use the vlogger -n feature.

Here's the code:
#!/bin/sh
#
# this program will scan the logs created by vlogger,
# create an awstat configuration file for each of them
# and then execute an update of the awstats statistics
#
# it assumes that vlogger rotation is disabled (-n option)
# a good way is to rotate the logs with logrotate and run
# this program in the prerotate directive
# this shold be done if you dont want to lose any record in the rotation
#
# you can run this program as often as you need as a cron job
#
# Apache log facility setting:
# LogFormat "%v %h %l %u %t \"%r\" %&#62;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
# CustomLog "&#124; /usr/sbin/vlogger -n -s access.log -t access.log /var/log/apache2" combined
#
# This program is based on the idea from dave
# http://davelozier.com/2008/06/20/awstats-vlogger/

logdir=/var/log/apache2
confdir=/etc/awstats
datadir=/var/lib/awstats
cgidir=/cgi-bin
logfile=access.log
awCommonSetupFile=/etc/awstats/awstats.conf.local
apacheUser=www-data
apacheGroup=www-data

# check if we are the only running instance of the program
LOCK="/tmp/${0##*/}.lock"
[ -e "${LOCK}" ] &#38;&#38; exit 0
touch "${LOCK}"

# if a log directory exists in /var/log/apache and this site has no awstat conf file
# create it awstat.sitename.conf
cd $logdir
for directory in *
do
  # does the site (ServerName) directory exist and is there a matching awstats config file?
  awstatsconf="$confdir/awstats.$directory.conf"
  if [ -d ${directory} ]
  then
    if [ ! -f ${awstatsconf} ]
    then
        # create configuration file
        printf "Include \"%s\"\nLogFile=%s\nSiteDomain=%s\nDirData=%s\nDirCgi=%s\n" \
                $awCommonSetupFile \
                "$logdir/$directory/$logfile" \
                $directory \
                $datadir/$directory \
                $cgidir/$directory  &#62; $awstatsconf
        #create logging directory
        mkdir $datadir/$directory
    fi
  fi
done

# execute all updates found in $confdir
# this allow to execute manually added stats configuration files for sites not logged in the $logdir directory (smtp, ftp for instance)
cd $confdir
for conffile in awstats.*.conf
do
        # extract sitename from $conffile
        sitename=`echo $conffile &#124; awk 'BEGIN {FS="."} {i=2; while (i &#60; NF) {if (i&#60;(NF-1)) printf("%s.",$i); else printf("%s",$i); i++; }}'`
        # update stats
        /usr/lib/cgi-bin/awstats.pl -config=$sitename -update
done

#change ownership of stats data in order to allow the direct update from web interface (parameter AllowToUpdateStatsFromBrowser)
chown -R $apacheUser.$apacheGroup $datadir

#remove lockfile
rm "${LOCK}"

exit 0</description>
		<content:encoded><![CDATA[<p>Hello Dave,<br />
Starting from your idea, I wrote a fully automated script creating a conf file for each of the vlogger directories and executing awstats for each site found.<br />
I dont use the vlogger -n feature.</p>
<p>Here&#8217;s the code:<br />
#!/bin/sh<br />
#<br />
# this program will scan the logs created by vlogger,<br />
# create an awstat configuration file for each of them<br />
# and then execute an update of the awstats statistics<br />
#<br />
# it assumes that vlogger rotation is disabled (-n option)<br />
# a good way is to rotate the logs with logrotate and run<br />
# this program in the prerotate directive<br />
# this shold be done if you dont want to lose any record in the rotation<br />
#<br />
# you can run this program as often as you need as a cron job<br />
#<br />
# Apache log facility setting:<br />
# LogFormat &#8220;%v %h %l %u %t \&#8221;%r\&#8221; %&gt;s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221;" combined<br />
# CustomLog &#8220;| /usr/sbin/vlogger -n -s access.log -t access.log /var/log/apache2&#8243; combined<br />
#<br />
# This program is based on the idea from dave<br />
# <a href="http://davelozier.com/2008/06/20/awstats-vlogger/" rel="nofollow">http://davelozier.com/2008/06/20/awstats-vlogger/</a></p>
<p>logdir=/var/log/apache2<br />
confdir=/etc/awstats<br />
datadir=/var/lib/awstats<br />
cgidir=/cgi-bin<br />
logfile=access.log<br />
awCommonSetupFile=/etc/awstats/awstats.conf.local<br />
apacheUser=www-data<br />
apacheGroup=www-data</p>
<p># check if we are the only running instance of the program<br />
LOCK=&#8221;/tmp/${0##*/}.lock&#8221;<br />
[ -e &#8220;${LOCK}&#8221; ] &amp;&amp; exit 0<br />
touch &#8220;${LOCK}&#8221;</p>
<p># if a log directory exists in /var/log/apache and this site has no awstat conf file<br />
# create it awstat.sitename.conf<br />
cd $logdir<br />
for directory in *<br />
do<br />
  # does the site (ServerName) directory exist and is there a matching awstats config file?<br />
  awstatsconf=&#8221;$confdir/awstats.$directory.conf&#8221;<br />
  if [ -d ${directory} ]<br />
  then<br />
    if [ ! -f ${awstatsconf} ]<br />
    then<br />
        # create configuration file<br />
        printf &#8220;Include \&#8221;%s\&#8221;\nLogFile=%s\nSiteDomain=%s\nDirData=%s\nDirCgi=%s\n&#8221; \<br />
                $awCommonSetupFile \<br />
                &#8220;$logdir/$directory/$logfile&#8221; \<br />
                $directory \<br />
                $datadir/$directory \<br />
                $cgidir/$directory  &gt; $awstatsconf<br />
        #create logging directory<br />
        mkdir $datadir/$directory<br />
    fi<br />
  fi<br />
done</p>
<p># execute all updates found in $confdir<br />
# this allow to execute manually added stats configuration files for sites not logged in the $logdir directory (smtp, ftp for instance)<br />
cd $confdir<br />
for conffile in awstats.*.conf<br />
do<br />
        # extract sitename from $conffile<br />
        sitename=`echo $conffile | awk &#8216;BEGIN {FS=&#8221;.&#8221;} {i=2; while (i &lt; NF) {if (i&lt;(NF-1)) printf(&#8221;%s.&#8221;,$i); else printf(&#8221;%s&#8221;,$i); i++; }}&#8217;`<br />
        # update stats<br />
        /usr/lib/cgi-bin/awstats.pl -config=$sitename -update<br />
done</p>
<p>#change ownership of stats data in order to allow the direct update from web interface (parameter AllowToUpdateStatsFromBrowser)<br />
chown -R $apacheUser.$apacheGroup $datadir</p>
<p>#remove lockfile<br />
rm &#8220;${LOCK}&#8221;</p>
<p>exit 0</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AWstats with Vlogger Rotation by Dave</title>
		<link>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-3</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 06 Aug 2008 00:07:17 +0000</pubDate>
		<guid>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-3</guid>
		<description>Thanks for the tip! I wasn't trying to disable it though. I just wanted the logs compressed after having them parsed with AWStats.</description>
		<content:encoded><![CDATA[<p>Thanks for the tip! I wasn&#8217;t trying to disable it though. I just wanted the logs compressed after having them parsed with AWStats.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AWstats with Vlogger Rotation by croolyc</title>
		<link>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-2</link>
		<dc:creator>croolyc</dc:creator>
		<pubDate>Tue, 05 Aug 2008 06:26:51 +0000</pubDate>
		<guid>http://davelozier.com/2008/06/20/awstats-vlogger/#comment-2</guid>
		<description>easy way is disable vlogger rotation
-n param</description>
		<content:encoded><![CDATA[<p>easy way is disable vlogger rotation<br />
-n param</p>
]]></content:encoded>
	</item>
</channel>
</rss>
