OL tracking app response time on nginx

To track the response time let’s edit

/etc/nginx/nginx.conf

adding the $request_time to the log_format line:


    log_format iacombined '$seed$remote_addr $host $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time';

Note: $request_time includes the time to complete sending the data to the client.

To show the requests longer than 3 seconds:

sudo tail -F /var/log/nginx/access.log -s 0.1  | perl -ne '$|=1; $_ =~ / ([^ ]+$)/; if ($1 > 3.0) {print;}'

To show the requests longer than 3 second, hiding the 400 errors:

sudo tail -F /var/log/nginx/access.log -s 0.1  | grep -v '"-" 40. 0' --line-buffered | perl -ne '$|=1; $_ =~ / ([^ ]+$)/; if ($1 > 3.0) {print;}'