nginx access log 에 post 데이터 기록하기
일반적으로는 필요없는 부분입니다.
사용자의 post 데이터를 체크할 때 사용할 수 있는 방법이다.
nginx.conf 파일의 http 블럭에 log 포맷을 아래와 같이 지정합니다.
[code]
log_format request_log '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body"';
[/code]
$request_body 가 post 데이터입니다.
다음으로 server 블럭의 access_log 부분을 아래처럼 지정합니다.
[code]
access_log logs/access.log request_log buffer=32k;
[/code]
로그 파일을 기록하는 것은 I/O 부하를 증가시키기 때문에 buffer=32k 설정을 추가해서
버퍼에 저장 후 파일에 기록하도록 했습니다.
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 1개