After much swearing and cursing the ANAT tech department has finally come up with an automated self scaling script to maintain web stats accross multiple sites hosted on a single server using Webalizer. Please feel free to utilise these scripts.
################################### ## Script to add new logs to existing web stats ## ################################### BASE_OUTPUT_DIR='/home/anat/public_html/webstats/' BASE_LOGS_DIR='/var/log/apache2/access_logs/' LOGS_APPENDED_CHARS='_log.1' SED_LOGS_DIR=${BASE_LOGS_DIR//\//\\\/} #Replace / with \/ to get around SED regex substitution SED_LOGS_APPENDED_CHARS=${LOGS_APPENDED_CHARS/\./\\.} # Like above but replace . with \. for LOG in $( find "$BASE_LOGS_DIR" -name "*$SED_LOGS_APPENDED_CHARS" -type f ) do SITE=`echo "$LOG" | sed -e "s/$SED_LOGS_DIR//" -e "s/$SED_LOGS_APPENDED_CHARS//" ` mkdir -p $BASE_OUTPUT_DIR$SITE/ webalizer -o $BASE_OUTPUT_DIR$SITE/ -n $SITE $LOG done |
For full script with once off import functionality and other features please view the GoogleDoc here