#!/bin/bash
# Multilog 1.0.3, September 2000, by Chris Pepper
# Multilog controls DNSTran and Analog to automatically produce multiple traffic reports. Multilog is simple and highly automated, so it will automatically find and process new .cfg and log files, and the .cfg files only need to contain settings which are different from one file to the next.
# Multilog first runs DNSTran to look up IP addresses in the DNS. Since DNSTran can't recurse subdirectories, this script can process all the logfiles in a given directory, and optionally in all the immediate subdirectories of another directory (useful for logs transferred from another server); uncomment the appropriate extralog lines if desired. Analog is at ; DNSTran is at .
# Next Multilog runs Analog to generate a report from each config file in a certain directory.
# configdir should contain a set of Analog .cfg files, each including LOGFILE, HOSTNAME, HOSTURL, and OUTFILE directives. Other configuration is picked up from from the default files (probably /etc/analog.cfg).
# Note: This script does not run analog in its default configuration (with no +g option).
# Set variables for your local configuration here
logdir=/usr/local/apache/logs/
# directory where webserver puts logfiles
if [ ! -d $logdir ]
then
echo "multilog: logdir not found or not a directory."
exit
fi
basedir=~/multilog
# change this if config files and logs aren't in your homedir
configdir=$basedir/analog-cfg/
# directory containing .cfg files for Analog
dnstrandir=/usr/local/dnstran
# DNSTran directory, if installed
if [ -d $dnstrandir ]
then
extralogdir1=$basedir/extralogs/
# extralogdir1 may contain extra logfiles for DNSTran
echo "Starting DNStran."
cd /usr/local/dnstran; ./dnstran $logdir*access_log*
if [ -d $extralogdir1 ]
then
for extralogdir2 in $extralogdir1*
do
./dnstran $extralogdir2/*
done
fi
fi
echo
for configfile in $configdir*.cfg
do
echo "Analog: analyzing `basename $configfile .cfg`"
analog +g$configfile
done
echo
echo "Multilog complete."
echo