POST 본문을 로깅하려고 시도하고 http
절의 log_format
에 $request_body
을 추가하려고합니다. 그러나 access_log
명령은 "-"을 본문으로 인쇄합니다. (http
절에)실제로 nginx로 POST 요청 본문을 로깅합니다.
curl -d name=xxxx myip/my_location
내 log_format을 : 내가 사용하여 POST 요청을 보낼
log_format client '$remote_addr - $remote_user $request_time $upstream_response_time '
'[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
내 위치 정의 (서버 절에) :
location = /c.gif {
empty_gif;
access_log logs/uaa_access.log client;
}
어떻게하면 실제 POST 데이터를 인쇄 할 수 있습니까?
사운드는 해결책을 발견 : http://stackoverflow.com/questions/4939382/logging-post-data-from-request-body – aet