awstats
설치 ¶설치디렉토리는 WEB access 가 가능한곳 이면 어디나 가능하나 여러 도메인의 통계처리를 위해서 apache 의 DocumentRoot 디렉토리에 설치한다. 대개의 경우 서비스 하는 도메인은 모두 가상 호스트을 통한 접근이 되도록 한다.
필요한 파일이 있는 곳은 보통 /home/archives 로 잠정적으로 지정한다.
# cd /usr/local/apache2/htdocs # tar xvzf /home/archives/awstats-6.5.tar.gz 설치문서 ¶awststs-6.5 를 서비스가 가능한 가상호스트 밑으로 LINK 를 걸어준후 doc 문서를 입력한다.
# cd <서비스가 되고 있는 htdocs 의 경로> # ln -s /usr/local/apache2/htdocs/awststs-6.5/ . 웹창에서 URL 입력
http://<domain url>/awststs-6.5/docs/ 억세스 로그의 변경 및 확인 ¶아파치의 access 로그를 common 에서 combined 로 변경
CustomLog /yourlogpath/yourlogfile common -> CustomLog /yourlogpath/yourlogfile combined 설정 ¶# perl awstats_configure.pl ----- AWStats awstats_configure 1.0 (build 1.6) (c) Laurent Destailleur ----- This tool will help you to configure AWStats to analyze statistics for one web server. You can try to use it to let it do all that is possible in AWStats setup, however following the step by step manual setup documentation (docs/index.html) is often a better idea. Above all if: - You are not an administrator user, - You want to analyze downloaded log files without web server, - You want to analyze mail or ftp log files instead of web log files, - You need to analyze load balanced servers log files, - You want to 'understand' all possible ways to use AWStats... Read the AWStats documentation (docs/index.html). -----> Running OS detected: Linux, BSD or Unix Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'. If you want to use standard directory, you should first move all content of AWStats distribution from current directory: /usr/local/awstats-6.5 to standard directory: /usr/local/awstats And then, run configure.pl from this location. Do you want to continue setup from this NON standard directory [yN] ? [root@new tools]# pwd /usr/local/awstats/tools [root@new tools]# perl awstats_configure.pl ----- AWStats awstats_configure 1.0 (build 1.6) (c) Laurent Destailleur ----- This tool will help you to configure AWStats to analyze statistics for one web server. You can try to use it to let it do all that is possible in AWStats setup, however following the step by step manual setup documentation (docs/index.html) is often a better idea. Above all if: - You are not an administrator user, - You want to analyze downloaded log files without web server, - You want to analyze mail or ftp log files instead of web log files, - You need to analyze load balanced servers log files, - You want to 'understand' all possible ways to use AWStats... Read the AWStats documentation (docs/index.html). -----> Running OS detected: Linux, BSD or Unix Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'. If you want to use standard directory, you should first move all content of AWStats distribution from current directory: /usr/local/awstats-6.5 to standard directory: /usr/local/awstats And then, run configure.pl from this location. Do you want to continue setup from this NON standard directory [yN] ? y -----> Check for web server install Found Web server Apache config file '/usr/local/apache2/conf/httpd.conf' -----> Check and complete web server config file '/usr/local/apache2/conf/httpd.conf' Warning: You Apache config file contains directives to write 'common' log files This means that some features can't work (os, browsers and keywords detection). Do you want me to setup Apache to write 'combined' log files [y/N] ? y Add '<Directory>' directive AWStats directives added to Apache config file. -----> Update model config file '/usr/local/awstats-6.5/wwwroot/cgi-bin/awstats.model.conf' File awstats.model.conf updated. -----> Need to create a new config file ? Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y -----> Define config file name to create What is the name of your web site or profile analysis ? Example: www.mysite.com Example: demo Your web site, virtual server or profile name: > mailnara.co.kr -----> Define config file path In which directory do you plan to store your config file(s) ? Default: /etc/awstats Directory path to store config file(s) (Enter for default): > -----> Create config file '/etc/awstats/awstats.mailnara.co.kr.conf' Config file /etc/awstats/awstats.mailnara.co.kr.conf created. -----> Restart Web server with '/sbin/service httpd restart' Shutting down httpd: httpd (pid 1860) already running -----> Add update process inside a scheduler Sorry, configure.pl does not support automatic add to cron yet. You can do it manually by adding the following command to your cron: /usr/local/awstats-6.5/wwwroot/cgi-bin/awstats.pl -update -config=mailnara.co.kr Or if you have several config files and prefer having only one command: /usr/local/awstats-6.5/tools/awstats_updateall.pl now Press ENTER to continue... A SIMPLE config file has been created: /etc/awstats/awstats.mailnara.co.kr.conf You should have a look inside to check and change manually main parameters. You can then manually update your statistics for 'mailnara.co.kr' with command: > perl awstats.pl -update -config=mailnara.co.kr You can also read your statistics for 'mailnara.co.kr' with URL: > http://localhost/awstats/awstats.pl?config=mailnara.co.kr Press ENTER to finish... [root@new tools]# ls /etc/awstats awstats.mailnara.co.kr.conf DATA 생성 ¶우선 결과파일을 저장할 디렉토리를 만든다.
# mkdir /var/lib/awstats access 파일로 통계데이터를 실행한다, 데이터의 갯수에 따라 오랜시간이 걸릴수 있다. 참고 기다려라.
# perl awstats.pl -config=mailnara.co.kr -update Update for config "/etc/awstats/awstats.mailnara.co.kr.conf" With data in log file "/home/httpd/MAILNARA/logs/access_log"... Phase 1 : First bypass old records, searching new record... Searching new records from beginning of log file... Phase 2 : Now process new records (Flush history on disk after 20000 hosts)... Jumped lines in file: 0 Parsed lines in file: 975854 Found 229 dropped records, Found 0 corrupted records, Found 0 old records, Found 975625 new qualified records. # 결과데이터 누적된것 확인
# ls -l /var/lib/awstats/ total 700 -rw-r--r-- 1 root root 32136 Feb 9 12:28 awstats012006.mailnara.co.kr.txt -rw-r--r-- 1 root root 122981 Feb 9 12:29 awstats022006.mailnara.co.kr.txt 012006 은 1월의 데이터, 022006 은 2월의 데이터임. 이 파일은 로그가 갱신하기위해서 실행될때 이전의 데이터는 SKIP 하는 정보도 가지고 있음.
추가설정 ¶configure 파일을 복사
# cd /etc/awstats # cp awstats.mailnara.co.kr.conf awstats.direct.co.kr.conf 파일중의 log 파일의 경로를 변경.
LogFile="/home/httpd/CALLDIRECT/logs/access_log" DATA 생성
# perl awstats.pl -config=direct.co.kr -update Update for config "/etc/awstats/awstats.direct.co.kr.conf" With data in log file "/home/httpd/DIRECT/logs/access_log"... Phase 1 : First bypass old records, searching new record... Searching new records from beginning of log file... Phase 2 : Now process new records (Flush history on disk after 20000 hosts)... Jumped lines in file: 0 Parsed lines in file: 2064457 Found 196 dropped records, Found 17 corrupted records, Found 0 old records, Found 2064244 new qualified records. 크론에 등록 ¶/etc/cron.daily 디렉토리에 awstats 라는 파일로 아래의 내용을 생성한다.
# cat /etc/awstats #!/bin/sh /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=mailnara.co.kr-update /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=direct.co.kr -update # |
"Perl is executable line noise, Python is executable pseudo-code." |











