安裝 Proxy Server Log 分析程式
狼主修正版

hotball.gif (3809 bytes) 前言

為正確的掌握 Proxy server 的運作現況,以便於管理及改促進其效能,藉由其 log 記錄檔案之統計,可以進一步的正確掌握,作為調整效能之參考。

 

hotball.gif (3809 bytes) 本文件安裝環境

RedHat 6.0 + squid rpm版

hotball.gif (3809 bytes) 下載所需檔案

本程式所需檔案如下:

diamond2.gif (5268 bytes) Perl 版本 5.000 或者更高。

diamond2.gif (5268 bytes) fly

diamond2.gif (5268 bytes) pwebstats 程式。pwebstats-1.3.8.tar.gz。(請自行到該網站取得最新版本)

diamond2.gif (5268 bytes) Proxy Server 的 access.log 檔案。

diamond2.gif (5268 bytes) 相關檔案已下載至  福康國小 ( ftp://ftp.fkps.kh.edu.tw//Unix/proxy/ )

hotball.gif (3809 bytes) 安裝程式

diamond2.gif (5268 bytes) 將原程式檔 ( pwebstats-1.3.8.tar.gz  fly-1.6.5.Linux-2.1.125-i686.tar.gz )    tar 至想安裝的目錄 ( 本例以 /home/pwebstats )

cd  /home/pwebstats 

tar -zxvf  pwebstats-1.3.8.tar.gz

它會解開至 /home/pwebstats/pwebstats-1.3.8 目錄中,

cp -r /home/pwebstats/pwebstats-1.3.8/.  /home/pwebstats

rm -f -r /home/pwebstats/pwebstats-1.3.8

同樣作法, 解開 fly

cd  /home/fly

tar -zxvf  fly-1.6.5.Linux-2.1.125-i686.tar.gz

它會解開至 /home/fly/fly-1.6.5 目錄中,

cp -r /home/fly/fly-1.6.5/.  /home/fly

rm -f -r /home/fly/fly-1.6.5

diamond2.gif (5268 bytes)  修改 pwebstats

修改 第 1 行為正確的 Perl 位置:

#!/usr/bin/perl

 

新增 第 550 行 加入 big5 碼,才能顯示中文:

    print "<meta http-equiv=";
    print "    Content-Type";
    print " content=";
    print "text/html; charset=big5";
    print ">\n";

其他的中文設定可以自行修改。

您可以取回 pwebstats 已中文化檔

 

diamond2.gif (5268 bytes)  修改 conf/squid-proxy.conf 

        請參照和平國小 squid-proxy.conf 來修改相關設定。

 

diamond2.gif (5268 bytes)  設定及修改 Apache Web server

建立並建立所要放置資料之目錄 ( 以 /home/httpd/html/pwebstats 為例)

mkdir  /home/httpd/html/pwebstats 

chown nobody.nobody /home/httpd/html/pwebstats

修改 /etc/httpd/conf/srm.conf

在 DocumentRoot  (第20行) 下加上

Alias  /pwebstats  /home/httpd/html/pwebstats

diamond2.gif (5268 bytes)  測試運作 

執行  /home/pwebstats/pwebstats   -c   /home/pwebstats/conf/squid-proxy.conf

即可以將前一天的 Squid log 分析出來。

以 Browers 指向該資料位址,查看是否成功顯示資料。

http://proxy.xxx.xxx.xxx/pwebstats/index.html ( proxy.xxx.xxx.xxx 為 Web server 所在位址 )

PS. access.log.0 如果被執行過一次,即不能再被用,如果要重覆測試,請執行

/home/squid/bin/squid -k rotate 以再製新的 log 檔!

diamond2.gif (5268 bytes)  設定自動執行

        在 crontab 中設定自動統計 ( 以每天 3:00 為例 )  

執行 crontab -e            ( 以 root 登入哦!! )  

加入下列一行:


00  03  *  *  *   /home/pwebstats/pwebstats  -c    /home/pwebstats/squid-proxy.conf

hotball.gif (3809 bytes) 相關網站

diamond2.gif (5268 bytes)  pwebstats  http://www.unimelb.edu.au/pwebstats/

diamond2.gif (5268 bytes)  交通大學  http://proxy.nctu.edu.tw/

diamond2.gif (5268 bytes)  中山大學  http://proxy.nsysu.edu.tw/

diamond2.gif (5268 bytes)  福康國小 http://proxy.fkps.kh.edu.tw/

diamond2.gif (5268 bytes)  和平國小 http://proxy.hpps.kh.edu.tw/

 

hotball.gif (3809 bytes)   問題討論請來信 samit@mail.nsysu.edu.tw網路實驗室

 

diamond2.gif (5268 bytes)diamond2.gif (5268 bytes)  本文感謝 交通大學 中山大學 網路管理單位之引導 diamond2.gif (5268 bytes)diamond2.gif (5268 bytes)