[Linux] 웹 서버 로그 분석을 위한 webalizer 설치
웹로그 분석툴 webalizer 설치방법입니다.
프로그램 파일은
여기에서 다운 받으세요.
http://www.mrunix.net/webalizer/
webalizer 를 사용하기 위해선 gd 라이브러리가 설치 되어 있어야 합니다.
어지간한 배포판에서는 다 지원되고 있으니 특별한 경우를 제외하고는 거의 가능할겁니다.
test.co.kr 웹사이트 로그 분석입니다.
1. 압축 풀고 설치 하기
[root@korea src]# ls
webalizer-2.01-09-src.tgz
[root@korea src]# tar zxf webalizer-2.01-09-src.tgz
[root@korea src]# ls -al
total 415
drwxr-xr-x 3 root root 136 Jun 11 14:17 .
drwxr-xr-x 15 root root 360 May 27 11:37 ..
drwxr-xr-x 3 55 wheel 1176 Jun 11 14:17 webalizer-2.01-09
-rw-r--r-- 1 root root 418371 Jun 11 14:17 webalizer-2.01-09-src.tgz
압축이 풀린 디렉토리를 /usr/local/webalizer 라는 디렉토리로 옮겼습니다.
관리를 위한 디렉토리 이동이였을뿐 안하셔도 상관 없습니다.
[root@korea src]# mv webalizer-2.01-09 /usr/local/webalizer
[root@korea src]# cd /usr/local/webalizer/
[root@korea webalizer]# ls
CHANGES README.FIRST graphs.h msfree.png webalizer.1
COPYING aclocal.m4 hashtab.c output.c webalizer.LSM
Copyright configure hashtab.h output.h webalizer.c
DNS.README configure.in install-sh parser.c webalizer.h
INSTALL country-codes.txt lang parser.h webalizer.png
Makefile.in dns_resolv.c lang.h preserve.c webalizer_lang.h
Makefile.std dns_resolv.h linklist.c preserve.h
README graphs.c linklist.h sample.conf
2. 설치하기
[root@korea webalizer]# ./configure --with-language=korean creating
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether ln -s works... yes
checking for a BSD compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking whether char is unsigned... no
checking for main in -l44bsd... no
checking for main in -lm... yes
checking for main in -lz... yes
checking for gzrewind in -lz... yes
checking for main in -lpng... yes
checking for gdImagePng in -lgd... yes
checking for gd.h... /usr/include
checking for getopt.h... yes
checking for math.h... yes
checking default config dir... /etc
checking for language file... yes - korean
updating cache ./config.cache
creating ./config.status
creating Makefile
linking ./lang/webalizer_lang.korean to webalizer_lang.h
[root@korea webalizer]# make ; make install
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c webalizer.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c hashtab.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c linklist.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c preserve.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c dns_resolv.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c parser.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c output.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -I/usr/include -c graphs.c
gcc -o webalizer webalizer.o hashtab.o linklist.o preserve.o parser.o output.o dns_resolv.o graphs.o -lgd -lpng -lz -lm
rm -f webazolver
ln -s webalizer webazolver
/usr/bin/install -c webalizer /usr/local/bin/webalizer
/usr/bin/install -c -m 644 webalizer.1 /usr/local/man/man1/webalizer.1
/usr/bin/install -c -m 644 sample.conf /etc/webalizer.conf.sample
rm -f /usr/local/bin/webazolver
ln -s /usr/local/bin/webalizer /usr/local/bin/webazolver
[root@korea webalizer]#
설치가 끝났습니다. :) 어메 쉬운거 ~
3. 설정파일 편집
/etc 디렉토리에 webalizer.conf.sample 파일이 생성되어 있습니다.
샘플파일을 새로운 conf 파일로 복사 합니다.
cp webalizer.conf.sample test.co.kr.conf
test.co.kr.conf 파일을 편집합니다.
(1) 로그파일명 및 경로 입력
#LogFile /var/lib/httpd/logs/access_log
주석을 제거하고 분석하고 싶은 로그파일의 경로명과 파일명을 적어 주세요
LogFile /home/log/test_log
(2) 웹상에 보여질 웹 디렉토리 입력
#OutputDir /var/lib/httpd/htdocs/usage
주석을 제거하고 로그분석한 내용이 보여질 웹페이지 디렉토리를 적어 주세요
OutputDir /home/www/test/usage
(3) 분석된 사이트 호스트명 입력
#HostName localhost
주석을 제거하고 호스트네임을 입력합니다.
HostName www.test.co.kr
설정이 끝났습니다.
4. 로그분석하기
webalizer -c /etc/test.co.kr.conf
어쩌구 저쩌구 나오면서 로그 분석을 하며
3-2 에서 지정한 디렉토리에 index.html 파일등이 생성됩니다.
로그파일이 큰 경우, 서버에 트래픽이 많이 걸리는 시간을 피해서
로그 분석을 하시는것이 좋습니다. ( 로그 분석시 서버에 로드가 많이 걸립니다 )
프로그램 파일은
여기에서 다운 받으세요.
http://www.mrunix.net/webalizer/
webalizer 를 사용하기 위해선 gd 라이브러리가 설치 되어 있어야 합니다.
어지간한 배포판에서는 다 지원되고 있으니 특별한 경우를 제외하고는 거의 가능할겁니다.
test.co.kr 웹사이트 로그 분석입니다.
1. 압축 풀고 설치 하기
[root@korea src]# ls
webalizer-2.01-09-src.tgz
[root@korea src]# tar zxf webalizer-2.01-09-src.tgz
[root@korea src]# ls -al
total 415
drwxr-xr-x 3 root root 136 Jun 11 14:17 .
drwxr-xr-x 15 root root 360 May 27 11:37 ..
drwxr-xr-x 3 55 wheel 1176 Jun 11 14:17 webalizer-2.01-09
-rw-r--r-- 1 root root 418371 Jun 11 14:17 webalizer-2.01-09-src.tgz
압축이 풀린 디렉토리를 /usr/local/webalizer 라는 디렉토리로 옮겼습니다.
관리를 위한 디렉토리 이동이였을뿐 안하셔도 상관 없습니다.
[root@korea src]# mv webalizer-2.01-09 /usr/local/webalizer
[root@korea src]# cd /usr/local/webalizer/
[root@korea webalizer]# ls
CHANGES README.FIRST graphs.h msfree.png webalizer.1
COPYING aclocal.m4 hashtab.c output.c webalizer.LSM
Copyright configure hashtab.h output.h webalizer.c
DNS.README configure.in install-sh parser.c webalizer.h
INSTALL country-codes.txt lang parser.h webalizer.png
Makefile.in dns_resolv.c lang.h preserve.c webalizer_lang.h
Makefile.std dns_resolv.h linklist.c preserve.h
README graphs.c linklist.h sample.conf
2. 설치하기
[root@korea webalizer]# ./configure --with-language=korean creating
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether ln -s works... yes
checking for a BSD compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking whether char is unsigned... no
checking for main in -l44bsd... no
checking for main in -lm... yes
checking for main in -lz... yes
checking for gzrewind in -lz... yes
checking for main in -lpng... yes
checking for gdImagePng in -lgd... yes
checking for gd.h... /usr/include
checking for getopt.h... yes
checking for math.h... yes
checking default config dir... /etc
checking for language file... yes - korean
updating cache ./config.cache
creating ./config.status
creating Makefile
linking ./lang/webalizer_lang.korean to webalizer_lang.h
[root@korea webalizer]# make ; make install
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c webalizer.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c hashtab.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c linklist.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c preserve.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c dns_resolv.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c parser.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -c output.c
gcc -Wall -O2 -DETCDIR=\"/etc\" -DHAVE_GETOPT_H=1 -DHAVE_MATH_H=1 -I/usr/include -c graphs.c
gcc -o webalizer webalizer.o hashtab.o linklist.o preserve.o parser.o output.o dns_resolv.o graphs.o -lgd -lpng -lz -lm
rm -f webazolver
ln -s webalizer webazolver
/usr/bin/install -c webalizer /usr/local/bin/webalizer
/usr/bin/install -c -m 644 webalizer.1 /usr/local/man/man1/webalizer.1
/usr/bin/install -c -m 644 sample.conf /etc/webalizer.conf.sample
rm -f /usr/local/bin/webazolver
ln -s /usr/local/bin/webalizer /usr/local/bin/webazolver
[root@korea webalizer]#
설치가 끝났습니다. :) 어메 쉬운거 ~
3. 설정파일 편집
/etc 디렉토리에 webalizer.conf.sample 파일이 생성되어 있습니다.
샘플파일을 새로운 conf 파일로 복사 합니다.
cp webalizer.conf.sample test.co.kr.conf
test.co.kr.conf 파일을 편집합니다.
(1) 로그파일명 및 경로 입력
#LogFile /var/lib/httpd/logs/access_log
주석을 제거하고 분석하고 싶은 로그파일의 경로명과 파일명을 적어 주세요
LogFile /home/log/test_log
(2) 웹상에 보여질 웹 디렉토리 입력
#OutputDir /var/lib/httpd/htdocs/usage
주석을 제거하고 로그분석한 내용이 보여질 웹페이지 디렉토리를 적어 주세요
OutputDir /home/www/test/usage
(3) 분석된 사이트 호스트명 입력
#HostName localhost
주석을 제거하고 호스트네임을 입력합니다.
HostName www.test.co.kr
설정이 끝났습니다.
4. 로그분석하기
webalizer -c /etc/test.co.kr.conf
어쩌구 저쩌구 나오면서 로그 분석을 하며
3-2 에서 지정한 디렉토리에 index.html 파일등이 생성됩니다.
로그파일이 큰 경우, 서버에 트래픽이 많이 걸리는 시간을 피해서
로그 분석을 하시는것이 좋습니다. ( 로그 분석시 서버에 로드가 많이 걸립니다 )