Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS beanstalk environment isn't rotating docker container logs

I am running a scala app on elastic beanstalk and the server gets overfilled with container logs which are not rotated. The default scheme of beanstalk rotates docker logs in the /var/log/eb-docker/containers/eb-current-app/* folder, but additional logs are accumulating in /var/lib/docker/containers/<container-id>/* and since they are not rotating the disk becomes full very quickly.

I've tried dealing with this problem by adding another logrotation claues to /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.applogs.conf manually, and this solved the problem.

However, when I try to implement the change in every instance beanstalk launches using an .ebextension config file, the altered log rotation file does not appear on the server.

Here is my .config file -

files:
  "/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.applogs.conf":
    mode: "000644"
    content: |
      /var/log/eb-docker/containers/eb-current-app/* {
      size 10M
      rotate 5
      missingok
      compress
      notifempty
      copytruncate
      dateext
      dateformat %s
      olddir /var/log/eb-docker/containers/eb-current-app/rotated
      }

      /var/lib/docker/containers/*/*.log {
      size 10M
      rotate 5
      missingok
      compress
      notifempty
      copytruncate
      dateext
      dateformat %s
      olddir /var/log/eb-docker/containers/eb-current-app/rotated
      }

I've also tried to use the simplest form of config file I've found in this reddit post - https://www.reddit.com/r/aws/comments/2u3afj/elastic_beanstalk_issues_with_ebextensions/, but it also failed to have any effect on my launched instances.

Any advice as to why my configuration fails to affect the environment would be greatly appreciated.

like image 327
Yaron Idan Avatar asked Apr 24 '16 13:04

Yaron Idan


1 Answers

Sadly, the problem ended up being a typo. I created a folder called .ebextentsion. When I fixed it everything started to work nicely.

like image 73
Yaron Idan Avatar answered Oct 16 '22 16:10

Yaron Idan