AWS beanstalk环境不会旋转docker容器日志

时间:2022-08-25 07:52:16

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.

我正在弹性beanstalk上运行一个scala应用程序,服务器过量使用未旋转的容器日志。 beanstalk的默认方案将docker日志旋转到/ var / log / eb-docker / containers / eb-current-app / *文件夹中,但其他日志正在/ var / lib / docker / containers / 中累积/ *并且由于它们没有旋转,因此磁盘变得非常快。

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.

我已经尝试通过手动向/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.applogs.conf添加另一个logrotation claues来解决这个问题,这解决了这个问题。

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.

但是,当我尝试使用.ebextension配置文件在每个实例beanstalk启动时实现更改时,更改的日志轮换文件不会出现在服务器上。

Here is my .config file -

这是我的.config文件 -

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.

我也尝试使用我在这篇reddit帖子中找到的最简单的配置文件--https://www.reddit.com/r/aws/comments/2u3afj/elastic_beanstalk_issues_with_ebextensions/,但它也没有任何配置文件对我发起的实例的影响。

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

关于为什么我的配置不会影响环境的任何建议将不胜感激。

1 个解决方案

#1


3  

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

可悲的是,这个问题最终成了一个错字。我创建了一个名为.ebextentsion的文件夹。当我修复它时,一切都开始很好地工作了。

#1


3  

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

可悲的是,这个问题最终成了一个错字。我创建了一个名为.ebextentsion的文件夹。当我修复它时,一切都开始很好地工作了。