아파치 로그파일 정리하기....
글   쓴   이 linux
날         짜 2003년 01월 19일 00시 24분 03초
본         문 http://www.linuxchannel.net/docs/apache_log.txt
위사이트에 가보면 자세히 설명되어 있다.

목적은 가능한 access_log 파일에

- 방문자 외에 localhost에서 php가 실행하는 로그 기록은 기록하지 않는다.
- 로봇들의 접근 기록은 따로 robot-log 파일에 기록한다.
- 운영자가 주고 접근할 IP 주소는 로그에 기록하지 않는다.
- *.gif, *.jpg, *.png, *.css, *.js, *.java 등과 같은 파일은 로그에 기록하지 않는다.

이 정도의 조건이라면 가능한 어느 정도 수준으로 순수 방문자의 접근 기록만
access_log 파일에 기록할 수 있습니다.

-- httpd.conf(실제로 필자가 운영하는 아파치 설정 내용임) --------------------
##
## 중간 생략
##
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{User-Agent}i\"" use_robot
##
## 중간 생략
##

## 환경변수 do_not_log에 일치하지 않은 접근만 access_log 파일에 기록함.
##
CustomLog /usr/local/apache/logs/access_log combined env=!do_not_log

## 중간 생략

## 로봇들은 따로 robot_log 파일에 user_robot 포맷에 맞게 기록함
##
CustomLog /usr/local/apache/logs/robot_log use_robot env=is_a_robot

## 중간 생략

## 특정 IP 주소는 로그에 기록하지 않는다.
## 주로 서버 IP 주소와 운영자가 자주 접속하는 IP 주소들
##
SetEnvIf Remote_Addr "^127.0.0.1$" do_not_log
SetEnvIf Remote_Addr "^211.35.159.12[89]$" do_not_log
SetEnvIf Remote_Addr "^211.35.159.1[345][0-9]$" do_not_log

## 중간 생략

## 주로 이미지 파일을 요청했을 경우 로그에 기록하지 않는다.
##
SetEnvIfNoCase Request_URI "\.(gif|jpg|png|css|js|java)$" do_not_log

## 중간 생략

## 로봇들의 환경변수 지정
##
BrowserMatchNoCase "ru-robot" do_not_log is_a_robot
BrowserMatchNoCase "Slurp/si" do_not_log is_a_robot
BrowserMatchNoCase "Mercator" do_not_log is_a_robot
BrowserMatchNoCase "Gulliver" do_not_log is_a_robot
BrowserMatchNoCase "SyncIT/" do_not_log is_a_robot
BrowserMatchNoCase "FAST-WebCrawler" do_not_log is_a_robot
BrowserMatchNoCase "Lycos_Spider" do_not_log is_a_robot
BrowserMatchNoCase "^ia_archive" do_not_log is_a_robot
BrowserMatchNoCase "^tv" do_not_log is_a_robot
BrowserMatchNoCase "Scooter" do_not_log is_a_robot
BrowserMatchNoCase "ZyBorg/" do_not_log is_a_robot
BrowserMatchNoCase "KIT-Fireball" do_not_log is_a_robot
BrowserMatchNoCase "Googlebot/" do_not_log is_a_robot
BrowserMatchNoCase "DIIbot/" do_not_log is_a_robot
BrowserMatchNoCase "teoma_agent3" do_not_log is_a_robot
BrowserMatchNoCase "empas_robot" do_not_log is_a_robot


관련 게시물 : 1 (Total 1 Articles)
번 호 제 목 글쓴이 작성일 조회수 선 택
1  아파치 로그파일 정리하기.... linux03-01-19467