Posts

Showing posts with the label monitor

Monitor Upstream Response Time with Nginx and CloudWatch

Image
Monitor Upstream Response Time with Nginx and CloudWatch Last week we saw how we could Setup CloudWatch to push logs from our application to CloudWatch . Apart from the application logs, another type of logs that is worth looking into are the access logs from Nginx. Nginx being the entrypoint of the application, every traffic in and out goes through it and today we will see how we can leverage its access logs to monitor the response time of our application from CloudWatch in three parts: Setup Nginx to log upstream response time Setup logs to be pushed to CloudWatch Setup metrics filter on CloudWatch 1. Setup Nginx to log upstream response time By default Nginx does not log the upstream response time. In order to print it, we can create a new log format which includes it and configure logs to be written into a file using that format. We can add our log configuration in a file called log_format.conf which we can place under /etc/nginx/conf.d/ and nginx will include the configu...