문제 : 아파치 접속 로그에 로드밸런서 혹은 공인ip한개로만 찍힌다. 실 사용자의 Ip들이 찍히게 하고싶다.
사전작업 : 로드밸런서 혹은 WAF에 클라이언트 ip 를 X-Forwarded-For 헤더 정보로 넘겨주는 설정이 되어있어야한다.
작업내용 :
1. vim /etc/httpd/conf/httpd.conf
2. 기존의 combined 라인 주석처리 후 %h를 %{X-Forwarded-For }i 로 변경
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
3. 아파치 재기동
service httpd restart
확인 : access log 확인
1. cat access_log | tail | cut -d' ' -f-6
감사합니다.
'WEB > Apache' 카테고리의 다른 글
[Apache] Apache 2.4.58 install (0) | 2024.02.26 |
---|---|
[Apache] 아파치 설정파일 위치 확인하기 (ex .httpd.conf) (0) | 2024.01.25 |
[Apache] Apache install (0) | 2023.07.24 |