Tikiboy
Tikiboy

Reputation: 912

Managing/deleting/rotating/streaming Elastic Beanstalk Logs

I am using Amazon EB for the first time. I've setup a Rails app running on linux and puma.

So far, I've been viewing logs through the eb logs command. I know that we can set EB to rotate the logs to S3 or stream it to CloudWatch.

My question here revolved around the deletion of the various log files.

  1. Will the various logs, such as puma.log be deleted automatically or must I do it myself?
  2. If i setup log rotations to S3, will the log files on the EC2 instance be deleted (and a fresh copy created in its place) when it gets rotated to S3? Or does it just keep growing indefinitely?
  3. If i stream it to CloudWatch, will the same copy of the log be kept on the EC2 instance and grow indefinitely?

I've googled around but can't seem to find any notion of "Log management" or "log deletion" in the docs or on SO.

Upvotes: 2

Views: 5852

Answers (1)

albert
albert

Reputation: 4468

I'm using beanstalk on a LAMP project and I can answer a few of your questions.

  1. You have to setup your log rotation policy at least on your app logs. Check if your base image already rotate this logs for you. The config should be in /etc/logrotate.conf for linux

  2. When you use S3 logs with Beanstalk, it already tails and delete the logs after 15min. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html#health-logs-s3location

  3. The same copy of the log will be kept in your EC2 instance. Your log rotation policy /etc/logrotate.conf will be the one that will delete it. awslogs will keep some metadata to know which was the processed chunk of the logs so it does not create duplicates.

If you want an example on how to use cloudwatch logs with elasticbeanstalk check: http://www.albertsola.pro/store-aws-beanstalk-symfony-and-apache-logs-in-cloudwatch-logs/

Upvotes: 4

Related Questions