全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1992
推到 Plurk!
推到 Facebook!

Multi-Domain 訪客流量分析加強版 -- Awstats 5.0

 
AB
高階會員


發表:166
回覆:262
積分:125
註冊:2003-08-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-12-14 01:43:02 IP:61.64.xxx.xxx 未訂閱
http://www.adj.idv.tw/phpBB2/viewtopic.php?t=519    Multi-Domain 訪客流量分析加強版 -- Awstats 5.0    如果你玩過 webalizer...那你可能會認為玩得不夠...因為一旦跟 Awstats 比較起來...可以說是小屋見大屋...這套軟體它的特色很多...而且 Install 說明也寫的很好...相信看完說明大家應該都可以裝的起來才對..     不過他有一個缺點...那就是硬體要夠強...以 500MB 的 Log 檔來分析的話...在 AMD Athlon 1.2G and 512MB SDRAM 下...需要大概三分鐘的時間才能跑完...要是做 Multi-Domain 的話..那也可以...不過機器太慢...跑起來會很吃力就是...當然如果你不想這樣辛苦的話...裡面也有設定說可以讓你 Run 完之後就清掉 Log 或是 把它另存別的地方...讓這樣來加快它的速度...     而我們這次的目地也是要玩 Multi-Domain 的訪客流量分析...目前市面上有些主機代管的公司就是利用這套來計算使用的流量...相當的好用...而這邊我們要接著上一篇的設定--讓 Webalizer 幫你分析 Multi-Domain 訪客資料--我們將延用相同的 Apache 設定...     ScreenShot:       所需資料(這兩個 Viutual-Domain):  http://www.adj.idv.tw  http://demo.adj.idv.tw/virtual.php     完成結果參考如下:  http://www.adj.idv.tw/cgi-bin/awstats.pl?config=adj  http://www.adj.idv.tw/cgi-bin/awstats.pl?config=demo     Download Source:  http://awstats.sourceforge.net/     安裝步驟如下(原始 Document 寫的很清楚...建議參考裡面寫的):  Step 1 : Install and Setup     * Step 1-1  Configure your apache web server to have NCSA combined/XLF/ELF log format (you can use your own log format but this predefined logformat is often the best choice and make setup easier). You can do this by changing, in httpd.conf, following directives (See your apache manual for more information):  代碼:     CustomLog /yourlogpath/yourlogfile common  into  CustomLog /yourlogpath/yourlogfile combined       * Step 1-2  Copy the contents of the uncompressed cgi-bin folder from your hard drive to your server's cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).  代碼:     #cp -rpf wwwroot/cgi-bin/* /var/www/cgi-bin       * Step 1-3  If necessary (should not with most Perl interpreter), edit the first (top-most) line of awstats.pl file that is  代碼:     #!/usr/bin/perl  to reflect the path were your Perl interpreter is installed. Default value works for most of Unix OS, but it also might be  #!/usr/local/bin/perl  With Apache for Windows and ActivePerl interpreter, it might be  #!c:/program files/activeperl/bin/perl       * Step 1-4  Move AWStats icon sub-directories and its content into a directory readable by your web server, for example /yourwwwroot/icon or /yourwwwroot/icons.  代碼:     #cp -rpf icon/* /var/www/html       * Step 1-5  Copy awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. Note:  When you will run AWStats, it will first look for a config file named  awstats.myvirtualhostname.conf (if not found, will look for awstats.conf).  Whatever the name you choose, this new file must be stored in  - /etc/opt/awstats or /etc/awstats or /etc or same directory than awstats.pl (so cgi-bin)  代碼:     for Unix/Linux users.  在這邊我建立兩個檔案-- awstats.adj.conf and awstats.demo.conf on /var/www/cgi-bin/ --       * Step 1-6  Edit this new config file with your own setup :  代碼:     #vi /var/www/cgi-bin/awstats.adj.conf  修改這幾個地方成為  LogFile="/var/log/httpd/main/access_log"  SiteDomain="www.adj.idv.tw"  Lang="tw"  ...  參數實在太多...請參考Readme     #vi /var/www/cgi-bin/awstats.demo.conf  LogFile="/var/log/httpd/demo/access_log"  SiteDomain="demo.adj.idv.tw"  Lang="tw"       Step 2 : Build/Update Statistics  * Step 2-1  The first analyze/update of statistics can be made the first time manually from the command line (the first time, process may be long) :  代碼:     #/var/www/cgi-bin/awstats.pl -config=adj -update  #/var/www/cgi-bin/awstats.pl -config=demo -update     結果輸出大概如下  When update is finished, you should get a result like this:  Lines in file: 225730  Found 5 dropped records,  Found 124 corrupted records,  Found 0 old records,  Found 225601 new records.       * Step 2-2  You can add instructions in your crontab (Unix/Linux) or your task scheduler (for Windows), to launch frequently this Awstats update process.  代碼:     #crontab -e  新增這兩行..我想要每8個小時執行一次  0 */8 * * * /var/www/cgi-bin/awstats.pl -config=adj -update  5 */8 * * * /var/www/cgi-bin/awstats.pl -config=demo -update       Step 3 : Read Statistics  現在...Open Your Browser...輸入這樣就可以看到辛苦的成果囉...  http://www.adj.idv.tw/cgi-bin/awstats.pl?config=adj  http://www.adj.idv.tw/cgi-bin/awstats.pl?config=demo     終於大功告成...由於這個實在功能強大...因此安裝會比較不容易...不過一但裝起來...就會滿有成就感的囉...     ======================================================================        http://www.adj.idv.tw/phpBB2/viewtopic.php?t=638    記得之前有介紹過 Awstats For Linux 的安裝過程...今天不小心讓偶發現Windows IIS 下也可以做 Multi-Domain 的訪客分析...真是讓人興奮...因為大家都知道..在Windows平台下的軟體...什麼都嘛要錢...最近有找過一些Windows平台下的 Log Analyze...看一看還是沒有 Awstats 來的強...它真的是照福很多 Windows IIS 平台下的管理者囉...     在開始進行之前...你必需先完成 ActivePerl for IIS 的安裝...如果你還沒完成...請先參考這一篇:  ====================================================================== 讓 Windows IIS下也能跑跨平台的 Perl http://www.adj.idv.tw/phpBB2/viewtopic.php?t=637 轉載自:  DOB 網站建置百寶箱     如果有了 IIS 下跨平台的 Perl,您又何須費神在 Windows 2000 下安裝 Apache 來執行 perl 呢?那麼在IIS下要如何架構Perl呢?又要如何跨平台使用呢?     【下載及安裝 Active Perl 】     首先請下載新版 ActivePerl-5.8.0.804-MSWin32-x86.msi。  Download:  http://ftp.activestate.com//ActivePerl/Windows/5.8/ActivePerl-5.8.0.804-MSWin32-x86.msi     接著請安裝 Active Perl 。要注意的是路徑要設為 c:\usr\ 或是 c:\usr\local\ ( 原因後面會有詳細的說明 )。若是您的電腦有安裝 IIS 的話,那麼在安裝時系統會自動幫您整合。  以下將以 c:\usr\ 作為說明之目錄。     【IIS 之注意事項 】  對 IIS 的老手而言,這一段大概就可以省略了。不過筆者仍在此對 IIS 的初學者稍微的提醒一下下:     在您安裝 IIS 前,請預必確認您的系統中至少有一顆硬碟是 NTFS 的格式。  安裝好 IIS 後,在 Windows 2000 下預設的目錄為 C:\Inetpub\wwwroot\。若是您的 C 槽不是 NTFS 格式,請將它轉換為 NTFS 格式,或是將目指定至其他 NTFS 格式硬碟下的資料夾。有關 IIS 方面的管理及設定,     在此不便贅述;畢竟本篇不是 IIS 教學。  在 web 資料夾的權限方面 ( 滑鼠右鍵 -> 內容 -> 安全 ),一定要有一個Everybody的使用者,其權限至少要有讀取及執行、讀取、寫入。     【整合 Active Perl 及 IIS 】  請依照下步驟作設定:     1.「控制台」->「系統管理工具」->「Internet 服務管理員」->「您的 web 站台」->「內容」->「主目錄」,請將讀取及寫入打勾。  2.「控制台」->「系統管理工具」->「Internet 服務管理員」->「您的 web 站台」->「內容」->「主目錄」->「設定」->「應用程式對應」->「.pl 」->「編輯」,請將指令引擎打勾。這個目的是要讓 perl 可以在瀏覽器上執行。  3.「控制台」->「Internet 服務管理員」->「您的 web 站台」->「內容」->「主目錄」->「設定」->「應用程式對應」->「.plx 」->「編輯」,請將指令引擎打勾。  4.「控制台」->「系統管理工具」->「Internet 服務管理員」->「您的 web 站台」->「內容」->「主目錄」->「設定」->「新增」,在「執行檔」欄內鍵入 C:\usr\bin\Perl.exe "%s" %s,並在「副檔名」欄內鍵入 .cgi ,並將 指令引擎打勾。這個目的是為了讓 Perl 可以執行副檔名為「.cgi 」之 perl 執行檔。 接著只要一直按確定就可以了!     【開始執行 Perl 】     請先將下列程式碼複製起來,貼在記事本上,並將檔存在 web 的目錄之 test.pl 或 test.cgi 。  代碼:     #!/usr/bin/perl     print "content-type:text/html","\n\n";  print "<html>\n"; print "<head><title>test</title></head>\n"; print "<body><center>\n"; print "這是 CGI 測試。\n"; print "別懷疑...你已經Success啦。\n"; print "</body>\n"; print "</html>\n" 打關瀏覽器,並確定網路有連線。在網址欄鍵入 " http://localhost/test.pl " 或是 " http://localhost/test.cgi ",依您儲存的副檔名而定 。如果在螢幕上可以看到「這是 CGI 測試。別懷疑...你已經Success啦。」的字樣,表示您成功架構跨平台的 Perl 。 註:" http://localhost/ "也可以改成 " http://127.0.0.1/ "。 【結論 】 當您依上述步驟安裝好 Perl 後,以後您在 Windows 平台上寫 perl 時,開頭呼叫 perl 的執行路徑,依本篇說明而言就是 #!/usr/bin/perl ;若您安裝的路徑為 c:\usr\ ,那麼除了在【整合 Active Perl 及 IIS】的說明中所需要修改的路徑為 C:\usr\bin\Perl.exe "%s" %s ,開頭呼叫 perl 的執行路徑也就必須改成#!/usr/bin/perl 。而這樣的呼叫路徑和一般 Linux 主機下呼叫路徑是一樣的,這麼一來就達成所謂的跨平台了。 您可以依您的需求改變安裝路徑,以達成跨平台,畢竟每台 Linux 主機所提供 perl 的執行路徑不盡相同。 筆者只是針對一般的 Linux 主機的路徑作說明。 本篇說明只是在 Linux 平台與 Windows 的平台上達成基本的跨平台;所謂基本的跨平台,也只是基本語法可以達到跨平台。要達成完全的跨平台,目前而言是不可能的;畢竟某些 Win32 下的模組,在 Linux上是不支援的,相對的,某些 Linux 平台上的功能 Windows 平台卻是沒有的。 上述而言,就以e-mail的傳送為例:在 Linux 平台上,只需要將寄信程式的路徑設定好就可以傳送信件了 ( 一般而言路徑為 /usr/sbin/sendmail ),而在 Win32 平台上絕對找不到這樣的路徑。那麼在 Win32 平台上要寄信怎麼辦?這時候就必須要用到 Win32 模組下的 Mail::Send 模組或是 Net::Smtp 或 Net::POP3 的模組了。 所以相同的問題就不要再問了。 ====================================================================== 接著 Download Awstats: 前往 Awstats 官方網站 http://awstats.sourceforge.net/ 在這邊以 Awstats-52.zip 為 Sample...你把壓縮檔解開後...可以看到裡面有個Docs的目錄...裡面寫的很清楚... 在這邊做個簡單的過程描述... 安裝過程 With IIS Server: * Step 1-1 Configure IIS to log in "Extended W3C log format" (You can still use your own log format but setup is easier if made like suggested). So, for this, start the IIS Snap-in, select the web site and look at its Properties. Choose W3C Extended Log Format, then Properties, then the Tab Extended Properties and uncheck everything under Extended Properties. Once they are all unchecked, check all following fields: 代碼:
 
date 
time 
c-ip 
cs-username 
cs-method 
cs-uri-stem 
sc-status 
sc-bytes 
cs-version 
cs(User-Agent) 
cs(Referer)
PS: 以上是要建立W3C擴充記錄檔格式...在擴充內容裡面...這幾個要選一樣的...不能多選...要不然在Run的過程中就會有問題...總共有十一個 To be sure the log format change is effective, you must stop IIS, remove all old log files, restart IIS and go to your homepage. This is an example of records you should get then in the new log file: 2000-07-19 14:14:14 62.161.78.73 - GET / 200 1234 HTTP/1.1 Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) http://www.from.com/from.htm * Step 1-2 Copy the contents of the uncompressed cgi-bin folder from your hard drive to your server's cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories). * Step 1-3 Move AWStats icon sub-directories and its content into a directory readable by your web server, for example C:\yourwwwroot\icon. PS:上面兩個步驟因為我要做 Windows版的 Multi-Domain...所以我在D槽建個 awstats的目錄...然後把 wwwroot裡面的cgi-bin 跟 icon 都copy在這邊... 在IIS的部份打算建虛擬目錄的方式...在個別IIS Domain的地方建兩個虛擬目錄... cgi-bin icon * Step 1-4 Copy awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. This new file must be stored in - same directory than awstats.pl (so cgi-bin) * Step 1-5 Edit this new config file with your own setup : 代碼:
--- Change LogFile value with full path of your web server log file (You can also use a relative path from your awstats.pl directory). 
PS: Windows的部份可以改成這樣 
LogFile="C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-0%MM-0Ý-0.log" 
注意你的Log的路徑     --- Change LogFormat to value "2" (it means "IIS Extended W3C log format"). 
如 LogFormat=2     --- Change DirIcons parameter to reflect relative path of icon directory. 
--- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com). 
--- You can change other parameters if you want. 
--- Set your primary language. 
Lang="tw" 
 
Step 2 : Build/Update Statistics * Step 2-1 The first analyze/update of statistics can be made the first time manually from the command line (the first time, process may be long) : awstats.pl -config=myvirtualhostname -update PS:在這邊你可以在cgi-bin裡面寫一個bat的執行檔...如 crontab.bat 內容如下 D:\awstats\cgi-bin\awstats.pl -config=adj -update 這樣你就可以不用每次還要叫出MS-DOS...而且可以利用這個檔案來做排程... AWStats will read the config file awstats.myvirtualhostname.conf (or if not found, awstats.conf) and create/update its database with all summary information issued from analyzed log file.AWStats database files are saved in directory defined by DirData parameter in config file. When update is finished, you should get a result like this: Lines in file: 225730 Found 5 dropped records, Found 124 corrupted records, Found 0 old records, Found 225601 new records. * Step 2-2 Even if AWStats allows "real-time" statistics with its "update from browser feature" (See next section Read Statistics), you should run an update process from a scheduler (command is same than first process) frequently. You can add instructions in your crontab (Unix/Linux) or your task scheduler (for Windows), to launch frequently this Awstats update process. For sites with: - 10,000 visitors a month Launch AWStats once a day - 50,000 visitors a month Launch AWStats once every 4 hours - 250,000 visitors a month Launch AWStats once an hour - 1,000,000 visitors a month Launch AWStats once an hour This is ABSOLUTELY necessary to keep good performances. PS:這個部份是依你的Log來建議你多久做一次排程...至於怎麼做排程??我實在不知道怎麼描述...不知道的人先找資料看看好了.. Step 3 : Read Statistics 好了之後...你可以打開Browser...輸入如下: http://www.adj.idv.tw/cgi-bin/awstats.pl?config=adj Online Demo: Awstats Online 這樣就行啦...當然你還可以在IIS底下..不是有個cgi-bin嗎?按右鍵選內容進去後...目錄安全設定...編輯...匿名存取拿掉...這樣別人要看這個cgi-bin裡面的資料就要打系統裡面有的帳號密碼才看的到囉...這樣是不是有更進一層的防護呢? God 在 2002-12-16 06:01 PM 作了最後編輯, 共編輯過 1 次 ===================================================================== 由於 ActivePerl-5.8.0.804-MSWin32-x86.msi 檔案11mb太大 請自行下載 安裝後執行的畫面如下 發表人 - ab 於 2003/12/14 23:39:01
系統時間:2024-07-05 13:42:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!