make
mv (webalizer dir) (home dir)/usage
/usr/local/webalizer/webalizer -c /home/httpd/html/usage
crontab 에 등록
http://cafe.naver.com/comhouse.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=564
***** logrotate 를 이용 파일을 자른후 webalizer 적용방법 ***************
이방법을 이용하면 위의 cron 설정이 필요없다..
보통 logrotate는 rpm 으로 설치가 되어있습니다..
[root@aaa weblog]# rpm -qi logrotate
Name : logrotate Relocations: (not relocateable)
Version : 3.5.9 Vendor: Red Hat, Inc.
Release : 1 Build Date: 2001년 09월 05일 (수) 오전 05시 40분 18초
Install date: 2002년 02월 27일 (수) 오후 10시 39분 40초 Build Host: porky.devel.redhat.com
Group : System Environment/Base Source RPM: logrotate-3.5.9-1.src.rpm
Size : 40032 License: GPL
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : Rotates, compresses, removes and mails system log files.
Description :
The logrotate utility is designed to simplify the administration of
log files on a system which generates a lot of log files. Logrotate
allows for the automatic rotation compression, removal, and mailing of
log files. Logrotate can be set to handle a log file daily, weekly,
monthly, or when the log file gets to a certain size. Normally,
logrotate runs as a daily cron job.
방법은 다음과 같다
cron 을 이용 logrotate를 실행후 logrotate를 이용 로그를 자른후 webalizer실행하는 방법이다..
crontab에 /usr/sbin/logrotate /etc/logrotate.conf 를 다음과 같이 등록한다.
crontab -e
0 5 * * * /usr/sbin/logrotate /etc/logrotate.conf
매일 5시마다 logrotate를 실행합니다..
만일 /etc/cron.daily/logrotate 가 있으면 cron 설정을 안해도 자동으로 처리해준다..
궁굼하시면 vi 로 열어보자..
vi /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
아마 이렇게 적혀있을거다.. 아래의 뜻은 logrotate를 적용시킨다는뜻이다..
자동으로 매일 실행하게 되있다..
/etc/logrotate 파일을 엽니다
vi /etc/logrotate
다음을 추가한다
/home/aaa/weblog/access_log {
daily
rotate 5
errors aaa@aaa.co.kr--------->에러발생시 받을 메일주소
size=100k--------------------->해당 용량만큼 rotate시킨다
postrotate postrotate ~ endscript 사이에 위에서 로그를 자른후 실행시킬 명령을 적어두는곳이다.
/opt/webalizer/webalizer -c /opt/etc/webalizer.conf
endscript
}
postrotate ~ endscript 사이에 위에서 로그를 자른후 실행시킬 명령을 적어두는곳이다.
마직막으로 aaa 호스트의 환경설정파일을 약간만 수정한다
vi /usr/local/webalizer/conf/aaa.co.kr.conf
여기서
logFile 에 /home/aaa/weblog/access_log.1
Incremental yes -------->제가 알기로는 이전 로그에 누적시킨다는 의미로 알고있는데 아니면 알려주세요
로 바꾸어 준다
LogFile의 경우 access_log가 아니라 access_log.1입니다.
logrotate가 log를 짜르면 access_log 파일에는 새로운 로그가 쌓이게 되고
현재까지 쌓인 로그는 access_log.1 파일로 짤려 나오기 때문입니다.
'linux > Install' 카테고리의 다른 글
A(2.0.54)P(5.0.4)M(4.1.18)++Zend+Tomcat (0) | 2007.03.15 |
---|---|
vsftpd 설치 (0) | 2007.03.15 |
MRTG (0) | 2007.03.15 |
net-snmp setting (0) | 2007.03.15 |
A(1.3.31)P(4.0)M(3.xx) setting (0) | 2007.03.15 |