You can store your logs on the application itself, but this can take up quite a lot of storage on your volume after a while. It can also be quite a hassle to have to monitor the logs as you have to enter your EC2 instance console.

To prevent this, we decided to send logs to Amazon CloudWatch Logs on our applications. This is a cheap way to be able to monitor our logs and it also enables us to set a retention period.

Setup a CloudWatch Logs IAM Policy and IAM Role

Before your EC2 can send log data to CloudWatch Logs, you have to create an IAM policy and IAM role to allow your EC2 instance to use the CloudWatch Logs APIs.

#rails #docker #cloudwatch-logs #ec2 #aws

Store Rails Logs on Amazon CloudWatch Logs (EC2 Docker)
1.70 GEEK