AWS Elastic Beanstalk .ebextensions 不更新默认配置



由于日志轮换,我的 Elastic Beanstalk 实例中存在内存磁盘问题,因此我尝试按照文档修改日志轮换的默认配置:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html

添加配置并重建环境后,当我通过 SSH 连接到我的 EB 时,我可以看到我的配置(在我指定的路径中(。但是,看起来我的更改没有应用,日志也不会根据我的配置轮换。

##################################################################
##  Sets up the elastic beanstalk log publication to include
##   the admin logs for cloudwatch logs
##################################################################
Resources:
AWSEBAutoScalingGroup:
Metadata:
"AWS::CloudFormation::Init":
configSets:
"_OnInstanceBoot":
"CmpFn::Insert":
values:
- EBCWLLogPublicationSetup
EBCWLLogPublicationSetup:
files:
"/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.awslogs.conf":
content: |
/var/log/awslogs.log {
size 2M
rotate 3
missingok
compress
notifempty
copytruncate
dateext
dateformat %s
olddir /var/log/rotated
}
mode: "000644"

我的EB实例包含一个Java应用程序(dropwizard,Java 1.8(,该应用程序已dockerized。

知道吗?

最后,我可以找到一种不同的方法:

container_commands:
01-custom-rotate:
command: "/bin/sed -i 's/size 10M/size 7M/g' /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.awslogs.conf"

基本上,它替换了配置文件中的文本。EB仍需要重建才能看到更改。

最新更新