How to add my own log to log rotation/S3 backup on Amazon Elastic Beanstalk?

Viewed 2270

We have a PHP application that lives on Amazon Elastic Beanstalk. The application has log rotation and backup to S3 enabled. Apache access and error logs do get properly rotated and backed up every hour.

However the application also creates its own log file. I want to do the same thing with it - every hour it should be rotated and backed up to S3. Following the instructions here I created the following file:

.ebextensions/publish-logs.config

files: 
  "/opt/elasticbeanstalk/tasks/publishlogs.d/cloud-init.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      /var/app/current/log/*.log

Then I uploaded the new version to Amazon.

The results - I see that the log file was backed up to S3 ONCE at the very first rotation. And it was not gzipped, just copied. After that, nothing. No new backups to S3. No rotation. When downloading bundle logs, the file is there, in its full glory of about 80MB now (accumulated over several days).

Amazon's documentation is pretty sparse. But it does say that:

When you configure your application's log files for log rotation, the application doesn't need to create copies of log files. Elastic Beanstalk configures logrotate to make a copy of your application's log files for each rotation.

What have I done wrong?

1 Answers
Related