[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Analog where users can see it?



> A client recently asked me to install Analog, a logfile statistics
> program:
> Well, this is already on the RaQs (v4.16 on my RaQ4).
> How can I set this up to spit out some type of result that my clients
> can read in their own directories?

Here's a script I use to create a daily analog report for each site.  I got
used to the daily analog reports from an old web hosting account on
Mindspring, so I tried to replicate the functionality they provided to all
web hosting customers.

-jim

#!/bin/bash

# Daily analog script for RaQ4
#
# This script will run analog on each site listed and create
# a file called stats.day.#.html for each site, where # is
# yesterday's day of the month.  Place this script in your
# /etc/cron.daily directory with appropriate file attributes
# and it will run at 4AM each day. Each site will have their
# own directory of daily analog reports, and the daily
# reports are overwritten each month to avoid using up too
# much disk space.
#
# This script assumes several things.  Among them are:
# - The site mysite.com is accessible via
#   cd /home/sites/www.mysite.com
# - The web logs for www.mysite.com are available in
#   /home/sites/www.mysite.com/logs/web.log*


# List of sites on the server to run analog on.
sites="mysite.com yoursite.org theirsite.net"


# The location of the analog executable and an analog
# config file named analog.cfg.
analogdir=/home/sites/home/analog/analog-5.01


# The root directory for storing the daily reports.
# Note that each site listed will have
# their daily reports stored in storagedir/sitename.
#
# I prefer to store these reports in a directory that is
# in the admin directory tree and the reports are all
# owned by admin. I provide a symbolic link to the
# stats directory for each client so that they can
# view their stats from the web using their domain.
# However, they don't have the priveleges
# required to overwrite the reports.
storagedir=/home/sites/home/analog


for site in $sites
do
  cd ${storagedir}
  if [ ! -d ${storagedir}/${site} ]
  then
    mkdir -p ${storagedir}/${site}
  fi
  cd ${analogdir}
  /bin/nice -20 ./analog +F-00-00-01 +T-00-00-01 +g${analogdir}/analog.cfg
+O${storagedir}/${site}/stats.day.%D.html
/home/sites/www.${site}/logs/web.log* +C"HOSTNAME ${site}"
  chown admin ${storagedir}/${site}/*
done