Difference between revisions of "Track HTTP Application Response time in Nginx"
Jump to navigation
Jump to search
↑ https://lincolnloop.com/blog/tracking-application-response-time-nginx/
↑ https://stackoverflow.com/a/39260524
(Changed redirect target from Nginx to Nginx.conf) Tag: Redirect target changed |
(Removed redirect to Nginx.conf) Tags: Removed redirect, Mobile web edit, Mobile edit |
||
Line 1: | Line 1: | ||
− | + | == Track Application Response time in Nginx <ref>https://lincolnloop.com/blog/tracking-application-response-time-nginx/</ref> == | |
+ | |||
+ | 1) Add to <code>/etc/nginx/nginx.conf</code> | ||
+ | |||
+ | http://nginx.org/en/docs/http/ngx_http_log_module.html | ||
+ | <pre> | ||
+ | log_format timed_combined '$remote_addr - $remote_user [$time_local] ' | ||
+ | '"$request" $status $body_bytes_sent ' | ||
+ | '"$http_referer" "$http_user_agent" ' | ||
+ | '$request_time $upstream_response_time $pipe'; | ||
+ | </pre> | ||
+ | :::<code>$pipe</code> “p” if request was [[pipelined]], “.” otherwise | ||
+ | :::<code>$request_time</code> | ||
+ | :::<code>$upstream_response_time</code> | ||
+ | |||
+ | 2) Modify access_log directive to use new format: | ||
+ | <pre> | ||
+ | access_log /var/log/nginx/yourdomain.com.access.log timed_combined; | ||
+ | </pre><ref>https://stackoverflow.com/a/39260524</ref> | ||
+ | |||
+ | :<code>request_time</code> This shows how long Nginx dealt with the request | ||
+ | :<code>upstream_response_time</code> Gives us the time it took our upstream server (in this case Apache/mod_wsgi) to respond | ||
+ | :<code>pipe</code> Shows ‘p’ in case the request was pipelined. | ||
+ | |||
+ | |||
+ | == See also == | ||
+ | * {{Nginx}} |
Revision as of 03:50, 21 April 2020
Track Application Response time in Nginx [1]
1) Add to /etc/nginx/nginx.conf
http://nginx.org/en/docs/http/ngx_http_log_module.html
log_format timed_combined '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" ' '$request_time $upstream_response_time $pipe';
$pipe
“p” if request was pipelined, “.” otherwise$request_time
$upstream_response_time
2) Modify access_log directive to use new format:
access_log /var/log/nginx/yourdomain.com.access.log timed_combined;
request_time
This shows how long Nginx dealt with the requestupstream_response_time
Gives us the time it took our upstream server (in this case Apache/mod_wsgi) to respondpipe
Shows ‘p’ in case the request was pipelined.
See also
- Web server: Nginx:
/etc/nginx/nginx.conf
,nginx -t
, Nginx logs, Nginx change log, PHP,php-fpm
, Let's encrypt, Nginx directives, Reverse Proxy, Configure HTTP redirection Nginx, Return,proxy_pass (Reverse proxy)
,ngx_http_rewrite_module
,/etc/nginx/sites-enabled/
,error.log
,access.log
,/nginx status
, AIO
Advertising: