사이트 내 전체검색
[linux] AWSTATs( 웹로그 분석) 툴 설치
로빈아빠
https://cmd.kr/server/449 URL이 복사되었습니다.

본문

AWSTATs( 웹로그 분석) 툴 설치 

1. Awstats 는
Webalizer와 같은 weblog 분석툴로서 webalizer보다 편한 설치와 뛰어난 분석력을 가지고 있는 장점이 있으며 현재 한글을 지원을 하나 완벽하게 지원하진 않는다 그래도 webalizer 보단 훨씬 깔끔한 인터페이스를 가지고 있다

2. setup
1) awstats를 다운을 받는다

http://awstats.sourceforge.net

http://prdownloads.sourceforge.net/awstats/awstats-6.2.tgz?use_mirror=puzzle

[root@localhost local]# wget  http://http://jaist.dl.sourceforge.net/sourceforge
/awstats/awstats-6.2.tgz

--10:34:48--  http://jaist.dl.sourceforge.net/sourceforge/awstats/awstats-6.2.tgz
          => `awstats-6.2.tgz'
Resolving jaist.dl.sourceforge.net... done.
Connecting to jaist.dl.sourceforge.net[150.65.7.130]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 860,606 [application/x-gzip]

100%[========================================================================================>] 860,606      225.92K/s    ETA 00:00

10:34:52 (225.92 KB/s) - `awstats-6.2.tgz' saved [860606/860606]


2) awstats를 압축을 푼후 /usr/local/awstats 로 mv 시키도록 한다

[root@localhost local]# mv awstats-6.2 /usr/local/src/awstats

    이때 반드시 권한을 설정을 해줘야 정상적으로 웹으로 뜬다

[root@localhost local]# chmod -R 705 awstats

3) cd /usr/local/awstats/tools

perl awstats_configure.pl 로 config를 한다

[root@localhost tools]# pwd 

/usr/local/awstats/tools

[root@localhost tools]# perl awstats_configure.pl


----- AWStats awstats_configure 1.0 (build 1.3) (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

-----> Check for web server install
  Found Web server Apache config file '/usr/local/apache/conf/httpd.conf'

-----> Check and complete web server config file '/usr/local/apache/conf/httpd.conf'
  AWStats directives already present.

-----> Update model config file '/usr/local/awstats/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:
> smile                        ß profile명이나 도메인명을 적는다

-----> 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): ß 위에 생성된 conf 파일이 저장될 디렉토리 지정을 한다
>

-----> Create config file '/etc/awstats/awstats.smile.conf'
Config file /etc/awstats/awstats.smile.conf created.

-----> 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/wwwroot/cgi-bin/awstats.pl -update -config=smile
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...


A SIMPLE config file has been created: /etc/awstats/awstats.smile.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'smile' with command:
> perl awstats.pl -update -config=smile
You can also read your statistics for 'smile' with URL:
> http://localhost/awstats/awstats.pl?config=smile

Press ENTER to finish...

[root@localhost tools]#

여기서 중점있게 봐야할 것이 /etc/awstats/awstats.smile.conf 라는 파일이 생성되었으며  /usr/local/apache/conf/http.conf 제일 하단에 아래와 같은 라인이 자동으로 추가가 되었다

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


4) 다음으로 /etc/awstats/awstats.smile.conf 를 알맞게 수정한다
51 Line

LogFile="/var/log/httpd/mylog.log"

LogFile="/usr/local/apache/logs/web3jibto_access_log"

197 Line

DirData="/var/lib/awstats"

DirData=”/usr/local/src/awstats/” ß 로그를 분석한 데이터를 저장할 디렉토리 지정이 디렉토리를 지정하고 반드시 위의 디렉토리를 생성해준다


6) 이제 로그파일을 분석할수 있는 실행을 해본다

[root@localhost cgi-bin]# /usr/local/awstats/wwwroot/cgi-
bin/awstats.pl -update -config=smile

Update for config "/etc/awstats/awstats.smile.conf"

With data in log file "/usr/local/apache/logs/web3jibto_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: 343

Found 0 dropped records,

Found 0 corrupted records,

Found 0 old records,

Found 343 new qualified records.


[root@localhost cgi-bin]# /usr/local/awstats/tools/awstats_updateall.pl now

Running '"./awstats.pl" -update -config=smile -configdir="/etc/awstats"' to update
config smile

Update for config "/etc/awstats/awstats.smile.conf"

With data in log file "/usr/local/apache/logs/web3jibto_access_log"...

Phase 1 : First bypass old records, searching new record...

Direct access after last parsed record (after line 343)

Jumped lines in file: 343

Found 343 already parsed records.

Parsed lines in file: 0

Found 0 dropped records,

Found 0 corrupted records,

Found 0 old records,

Found 0 new qualified records.



[root@localhost cgi-bin]# ls /usr/local/src/awstats

awstats012005.smile.txt

데이터가 생성되었다.

7) 웹으로 awstats로 로그를 확인 하여보자

아파치를 먼저 재실행을 한다

그리고 http://yourdomain/awstats/awstats.pl?config=yourconfig 을 웹에서 보자

ex) http://web3.jib.to/awstats/awstats.pl?config=smile 


8) cron에 등록하여 자동으로 update 하기

자동으로 update하는 커맨드롤 쉘파일로 만든다음 crontab에 등록을 하자

vi /etc/cron.daily/awstat.sh

#!/bin/bash

/usr/local/awstats/tools/awstats_updateall.pl now
 
이런식으로 설치가 완료가 되었다.

댓글목록

등록된 댓글이 없습니다.

1,139 (10/23P)

Search

Copyright © Cmd 명령어 18.217.208.220