Powered by coANDco UK

How to analyse standard apache logfiles using cat/awk

From How2s

Top ten viewed pages:

awk '{print $7}' /path/to/logfile | sort | uniq -c | sort -rn | head -10

Top ten referrers:

awk '{print $11}' /path/to/logfile | sort | uniq -c | sort -rn | head -10

Sum of data (in MB) transferred in the last 5000 hits

tail -5000 /path/to/logfile | awk '{sum+=$10} END {print sum/1048576}'
Please check out our sponsor, thanks to whom How2s.org is FREE: