Stuart
Stuart

Reputation: 3356

AWS elasticbeanstalk automating deletion of logs published to S3

I have enabled publishing of logs from AWS elasticbeanstalk to AWS S3 by following these instructions: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html

This is working fine. My question is how do I automate the deletion of old logs from S3, say over one week old? Ideally I'd like a way to configure this within AWS but I can't find this option. I have considered using logrotate but was wondering if there is a better way. Any help is much appreciated.

Upvotes: 1

Views: 902

Answers (1)

Stuart
Stuart

Reputation: 3356

I eventually discovered how to do this. You can create an S3 Lifecycle rule to delete particular files or all files in a folder more than N days old. Note: you can also archive instead of delete or archive for a while before deleting, among other things- it's a great feature.

How to add a S3 bucket LifeCycle rule

Reference: http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectExpiration.html and http://docs.aws.amazon.com/AmazonS3/latest/dev/manage-lifecycle-using-console.html

Upvotes: 2

Related Questions