log nginx 客户端请求大小_nginx log记录请求响应时间
有時為了方便分析接口性能等,需要記錄請求的時長,通過修改nginx的日志格式可以做到,如
添加一個新的log_format
log_format? timed_combined? '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time $upstream_response_time';
然后引用這個新的日志格式
access_log? /var/log/nginx/access.log? timed_combined;
上面新增的參數是
request_time -This shows how long Nginx dealt with the request
upstream_response_time - Gives us the time it took our upstream server (in this case Apache/mod_wsgi) to respond
參考
https://lincolnloop.com/blog/tracking-application-response-time-nginx/
總結
以上是生活随笔為你收集整理的log nginx 客户端请求大小_nginx log记录请求响应时间的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大学生办理农行信用卡额度 初始额度一般5
- 下一篇: 手机可以挖矿狗狗币吗?手机挖矿是真的吗?