#!/usr/bin/perl # run getstats to create reports from httpd log files # this sample script is distributed with getstats 3.0 die "usage: run-gs-std \n\nfor example: run-gs 19980221\n" unless $#ARGV == 0; $date=$ARGV[0]; if (-x '/opt/local/bin/getstats') {$GETSTATS='/opt/local/bin/getstats';} elsif (-x '/usr/local/bin/getstats') {$GETSTATS='/usr/local/bin/getstats';} else {die("can't find getstats\n")} if (-x '/opt/local/bin/gzip') {$GZIP='/opt/local/bin/gzip';} elsif (-x '/usr/local/bin/gzip') {$GZIP='/usr/local/bin/gzip';} else {$GZIP='';} $rpt='/www/data/httpd/reports'; # regular reports $sta='/www/data/httpd/staff'; # public_html reports (restricted) $log='/www/data/httpd/log'; # log files are here $msg="/tmp/getstats-std-$date"; # parse error messages go here print STDERR "getstats will create reports for $date\n"; open (CMD, "|$GETSTATS 2>$msg") || die "failed: $GETSTATS 2>$msg\n"; print CMD " set date $date set defaulthost www.columbia.edu set domroot www.columbia.edu $rpt/columbia/dom set domroot www.ciaonet.org $rpt/ciao/dom set xtroot www.columbia.edu $log/xt/www set xtroot www.ciaonet.org $log/xt/ciao # how many levels to keep in memory set dtrlevels 6 set domlevels 2 set countbytes yes read std $log/fu/jonapot/httpd.access.$date.gz read std $log/fu/kwaziwai/httpd.access.$date.gz ##### # print reports for the main server set servername \"http://www.columbia.edu/\" set icon \"http://www.columbia.edu/httpd/getstats/getstats.gif\" set ignorepublic yes set sortkey nreq set ignoreimages no write dirtree 6 $rpt/columbia/$date.dtrreq6.html write dirtree 5 $rpt/columbia/$date.dtrreq5.html write dirtree 4 $rpt/columbia/$date.dtrreq4.html write dirtree 3 $rpt/columbia/$date.dtrreq3.html write dirtree 2 $rpt/columbia/$date.dtrreq2.html write dirtree 1 $rpt/columbia/$date.dtrreq1.html set sortkey alpha set ignoreimages no write dirtree 6 $rpt/columbia/$date.dtralp6.html write dirtree 5 $rpt/columbia/$date.dtralp5.html write dirtree 4 $rpt/columbia/$date.dtralp4.html write dirtree 3 $rpt/columbia/$date.dtralp3.html write dirtree 2 $rpt/columbia/$date.dtralp2.html write dirtree 1 $rpt/columbia/$date.dtralp1.html set sortkey nreq set ignoreimages yes write dirtree 6 $rpt/columbia/$date.htrreq6.html write dirtree 5 $rpt/columbia/$date.htrreq5.html write dirtree 4 $rpt/columbia/$date.htrreq4.html write dirtree 3 $rpt/columbia/$date.htrreq3.html write dirtree 2 $rpt/columbia/$date.htrreq2.html write dirtree 1 $rpt/columbia/$date.htrreq1.html set sortkey alpha set ignoreimages yes write dirtree 6 $rpt/columbia/$date.htralp6.html write dirtree 5 $rpt/columbia/$date.htralp5.html write dirtree 4 $rpt/columbia/$date.htralp4.html write dirtree 3 $rpt/columbia/$date.htralp3.html write dirtree 2 $rpt/columbia/$date.htralp2.html write dirtree 1 $rpt/columbia/$date.htralp1.html # report on public_html directories set ignorepublic no set sortkey nreq set ignoreimages no write dirtree 3 $sta/$date.dtrreq3.html write dirtree 2 $sta/$date.dtrreq2.html write dirtree 1 $sta/$date.dtrreq1.html # other reports: domain, redirects, errors # note: 2-level domain reports are created automatically # by the "set domroot" command write domain 1 $rpt/columbia/dom/$date.domreq1.html write redir 6 $rpt/columbia/$date.redir.html write error 6 $rpt/columbia/$date.error.list ##### # print reports for CIAO set servername \"http://www.ciaonet.org/\" set icon \"https://www1.columbia.edu/sec/dlc/ciao/ciaobt.gif\" set ignorepublic yes set sortkey nreq set ignoreimages yes write dirtree 4 $rpt/ciao/$date.htrreq4.html write dirtree 3 $rpt/ciao/$date.htrreq3.html write dirtree 2 $rpt/ciao/$date.htrreq2.html write dirtree 1 $rpt/ciao/$date.htrreq1.html write domain 1 $rpt/ciao/dom/$date.domreq1.html write redir 6 $rpt/ciao/$date.redir.html write error 6 $rpt/ciao/$date.error.list "; close (CMD); system("chgrp www $rpt/*/$date*"); system("chmod a+r $rpt/*/$date*"); system("chgrp www $sta/$date*"); system("chmod o-r $sta/$date*"); if ($GZIP) {system("$GZIP $msg");} else {print "can't find gzip, $msg not compressed\n";} exit;