【nginx知識】01_nginx日志請求到達時間$time_local、請求處理時間request_time


 

由於性能測試需要,需指定請求到達ng后,ng后面的系統處理的時間,需要增加ng日志中關於系統處理時間的顯示。

requesttime:"request_time";

 

 

 

log_format main '$remote_addr - $remote_user [$time_local];"$request"requesttime:"$request_time";'
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

 

 

說明:

 [$time_local]:是ng收到請求的時間

"request_time":是ng將請求轉給后端,后端處理的時間。

 

注意:如果access_log這行被注釋掉了,記得放開。

 

 

 

修改完成后,記得重啟ng:

/nginx/sbin/nginx -s reload  

 最后去ng查看最新的日志,發現已經有響應時間咯。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM