nginx.conf
http{
...省略...
log_format post_tracking '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body" ';
}
也可以如此配置 让你更加的方便
log_format post_tracking '客户端地址:$remote_addr OR "$http_x_forwarded_for" [$time_local] 请求状态:$status 发送给客户端的字节数:$body_bytes_sent 客户浏览器信息:"$http_user_agent" \r\n >请求url跟请求协议:"$request" 参数:"$request_body" 处理时间:"$request_time" '
server
access_log
access_log /data/wwwlogs/qubar_nginx.log post_tracking
重启
systemctl reload nginx
查看成果
tail -f /data/wwwlogs/qubar_nginx.log
如下成功
[16/Apr/2018:10:37:23 +0800] "POST /bar/field HTTP/1.1" 200 620 "-" "okhttp/3.9.1" "-" "barId=8&orderDate=2018-04-16"