Reyesoft
Published in

Reyesoft

Track and log slow nginx requests

Photo by Nareeta Martin on Unsplash
log_format timed_combined  '$request_time $upstream_response_time'
' [$time_local]'
' "$request" $status $body_bytes_sent';
access_log /var/log/nginx/access.log timed_combined;
$ tail -f /var/log/nginx/access.log
0.002 0.000 [25/Feb/2022:19:06:29 +0000] "GET /1630-es2015.js HTTP/1.1" 200 4524
0.003 0.004 [25/Feb/2022:19:06:29 +0000] "GET /assets/landing-page.jpg HTTP/1.1" 200 814
1.765 1.764 . [25/Feb/2022:19:06:34 +0000] "GET /saldo/banco/ HTTP/1.1" 200 98333
0.007 0.008 . [25/Feb/2022:19:06:55 +0000] "GET /6997-es2015.f767960602ec613104db.js HTTP/1.1" 200 933
$ tail -f /var/log/nginx/access.log | awk '$1+0 >= 0.5'
1.765 1.764 . [25/Feb/2022:19:06:34 +0000] "GET /saldo/banco/ HTTP/1.1" 200 98333

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pablo Reyes

Desarrollador Web. Emprendedor compulsivo. Apasionado por el cine, los viajes y la fotografía. CEO de SaldoAr y Reyesoft. Trato de no dejar nada a medi