#!/bin/sh # single-site-shared-log, Copyright 2000 Boutell.Com, Inc. # # EXAMPLE SCRIPT FOR ANALYZING A SINGLE SITE WHICH SHARES # A LOG FILE WITH OTHER SITES. THIS SCRIPT SHOULD ONLY BE # USED TOGETHER WITH 'many-sites-shared-log', WHICH # PROVIDES LOG ROTATION AND LOG ARCHIVING AFTER INVOKING # THIS SCRIPT ONE OR MORE TIMES. # # YOU MAY NEED TO MODIFY THIS SCRIPT. READ IT CAREFULLY. # # This Unix shell script analyzes a single web site which # shares a log file with other sites. The name of the web site # should be specified on the command line, like so, without the # '#' symbol in front: # # single-site-shared-log companyname # # THIS SHOULD ONLY BE DONE from the many-sites-shared-log SCRIPT. # This script is not designed to be used alone. # # The script will then assume that your configuration file is # called companyname.conf, the SHARED log file for all sites # is called access-log, the report directory for # this site is called /home/sites/home/users/companyname/web/usage, # and the shared log file is kept in a directory called # /var/log/httpd. # # All of this must be true for the script to actually work! # If any of this is not true, you must adjust the script to # meet your needs. # # It is typical to run this script late at night, using # a crontab entry. If you choose to run it as root, # you will wish to uncomment either the 'chmod' line or # the 'chown' line below, to make the reports world readable # or assign them to a specific Unix user. If you choose to run # it as an appropriate user it may not be necessary to do either. # STEP ONE # Change to the directory where wusage and its configuration # files are located. cd /home/sites/home/users/admin/wusage # STEP TWO # Run the wusage program. ./wusage -c $1.conf -l /var/log/httpd/access-log-current # STEP THREE # Change the ownership and/or permissions of the report files # so that they can be seen by a web server running as a specific # user, OR by everyone. Uncomment ONE of these options by removing # the # in front of the chmod or chown line. If you are running # this script as an appropriate user, not as root, then it # is often unnecessary to do either one. # # IF YOU WANT PRIVACY FOR YOUR REPORTS, use the features of your # web server to password-protect the directory in which they # are kept. This is quite straightforward. See your web server's # documentation. # OPTION A: make reports readable by all accounts #chmod -Rf 755 /home/sites/$1/web/usage # OPTION B: give the reports to one specific account. # The company name must be the SAME as the account name. # If this is not true, you will need to customize this script. #chown -Rf $1 /home/sites/$1/web/usage # That's it! This script does not stand alone. It should # be invoked by many-sites-shared-log only.