#!/usr/bin/perl # run getstats to create reports from httpsd log files # this sample script is distributed with getstats 3.0 die "usage: run-gs-sec \n\nfor example: run-gs-www1 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='/wwws/data/acis/rad/web-usage/www1'; # secure server reports $log='/www/data/httpd/log'; # secure server logs $msg="/tmp/getstats-sec-$date"; # parse errors 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 www1.columbia.edu set domroot www1.columbia.edu $rpt/dom set xtroot www1.columbia.edu $log/xt/www1 # how many levels to keep in memory set dtrlevels 6 set domlevels 2 set countbytes yes read std $log/sec/howsit/httpsd.access.$date.gz ##### # print reports for the secure server set servername \"https://www1.columbia.edu/\" set icon \"https://www1.columbia.edu/icons/getstats.gif\" set ignorepublic yes set sortkey nreq set ignoreimages no write dirtree 6 $rpt/$date.dtrreq6.html write dirtree 5 $rpt/$date.dtrreq5.html write dirtree 4 $rpt/$date.dtrreq4.html write dirtree 3 $rpt/$date.dtrreq3.html write dirtree 2 $rpt/$date.dtrreq2.html write dirtree 1 $rpt/$date.dtrreq1.html set ignoreimages yes write dirtree 6 $rpt/$date.htrreq6.html write dirtree 5 $rpt/$date.htrreq5.html write dirtree 4 $rpt/$date.htrreq4.html write dirtree 3 $rpt/$date.htrreq3.html write dirtree 2 $rpt/$date.htrreq2.html write dirtree 1 $rpt/$date.htrreq1.html # other reports: domain, redirects, errors # note: 2-level domain reports are created automatically # by the "set domroot" command write domain 1 $rpt/dom/$date.domreq1.html write redir 6 $rpt/$date.redir.html write error 6 $rpt/$date.error.list "; close (CMD); system("chgrp www $rpt/$date*"); system("chmod o-r $rpt/$date*"); if ($GZIP) {system("$GZIP $msg");} else {print "can't find gzip, $msg not compressed\n";} exit;