Editing Track HTTP Application Response time in Nginx
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
<ref>https://lincolnloop.com/blog/tracking-application-response-time-nginx/</ref> | <ref>https://lincolnloop.com/blog/tracking-application-response-time-nginx/</ref> | ||
− | 1) Add to <code>/etc/nginx/ | + | 1) Add to <code>/etc/nginx/nginx.conf</code> |
+ | |||
+ | http://nginx.org/en/docs/http/ngx_http_log_module.html | ||
− | |||
log_format timed_combined '$remote_addr - $remote_user [$time_local] ' | log_format timed_combined '$remote_addr - $remote_user [$time_local] ' | ||
'"$request" $status $body_bytes_sent ' | '"$request" $status $body_bytes_sent ' | ||
'"$http_referer" "$http_user_agent" ' | '"$http_referer" "$http_user_agent" ' | ||
− | '$ | + | '$request_time $upstream_response_time $pipe'; |
− | </ | + | |
+ | :::<code>$pipe</code> “p” if request was [[pipelined]], “.” otherwise | ||
+ | :::<code>$request_time</code> | ||
+ | :::<code>$upstream_response_time</code> | ||
− | 2) Modify | + | 2) Modify access_log directive to use new format: |
<pre> | <pre> | ||
access_log /var/log/nginx/yourdomain.com.access.log timed_combined; | access_log /var/log/nginx/yourdomain.com.access.log timed_combined; | ||
Line 19: | Line 23: | ||
:<code>pipe</code> Shows ‘p’ in case the request was pipelined. | :<code>pipe</code> Shows ‘p’ in case the request was pipelined. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
* {{Nginx}} | * {{Nginx}} | ||
− | |||
− | |||
− |
Advertising: