奇科電腦 回奇科電腦首頁奇科電腦LPI課程資訊奇科電腦Embedded課程資訊奇科電腦Cisco課程資訊奇科電腦Programming課程資訊奇科電腦Smartphone App課程資訊
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


Best Browse: 1024x768 Copyright 2010 GeeGo Systems, Ltd.
service@geego.com.tw|DL: 0800-296-296|3F., No.60, Zhulun St., Zhongshan Dist., Taipei City 104, Taiwan (R.O.C.)|02-2711-6373