#!/bin/sh
#
# logsort [n]
#
# This little script shows the N sites that made the most requests
# to the web server.

if [ $# -lt 1 ];then T='cat';else T="tail -$1"; fi

{	cat  /var/log/apache_access_log;
	zcat /var/log/apache_access_log.1 
	zcat /var/log/apache_access_log.2 
	zcat /var/log/apache_access_log.3 
	zcat /var/log/apache_access_log.4 
	zcat /var/log/apache_access_log.5 
	zcat /var/log/apache_access_log.6 
	zcat /var/log/apache_access_log.7 
} | sed -e 's/ - - .*//' | sort | uniq -c | sort -b -n | $T

