




|
Tech Tips1
How to know frequency of web page surfing from server log files?
Author: Ben|Date: 2007/05/25|Back to Tech Tips
To quickly understand the top 20 web pages from Apache Server log files, a simple shell script is represented as follows:
#!/bin/bash export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" top() { for pages in `cut -d' ' -f7 /var/log/httpd/access_log | egrep ".*htm[l]*$|.*index\.php"` do echo "http://www.geego.com.tw$pages" done } if `top | sort | uniq -c | sort -nr | head -20 | mail -s 'The top 20 pages' webmaster@geego.com.tw` ; then echo "Top 20 pages sent successfully!" fi |