【发布时间】:2016-07-26 20:57:30
【问题描述】:
我有一个使用 Docker 容器部署的 Elastic Beanstalk 应用程序。应用程序本身就是一个 Java 应用程序。
我的目标是将日志发送到 Cloudwatch。特别是我想将 stdouterr.log 文件获取到 Cloudwatch。该文件可以在/var/log/eb-docker/containers/eb-current-app/*下找到
我关注了 AWS 官方文档 here。 根据示例配置文件,我设法将 nginx Webrequest 发送到 Cloudwatch。
对于 EB docker stdouterr 日志,我将 cwl-log-setup.config 文件修改为以下内容:
Mappings:
CWLogs:
ApplicationLogGroup:
LogFile: "/var/log/eb-docker/containers/eb-current-app/*"
TimestampFormat: "%d/%b/%Y:%H:%M:%S %z"
Outputs:
ApplicationLogGroup:
Description: "The name of the Cloudwatch Logs Log Group created for this environments web server access logs. You can specify this by setting the value for the environment variable: WebRequestCWLogGroup. Please note: if you update this value, then you will need to go and clear out the old cloudwatch logs group and delete it through Cloudwatch Logs."
Value: { "Ref" : "AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0WebRequestLogGroup"}
Resources :
AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0WebRequestLogGroup: ## Must have prefix: AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0
Type: "AWS::Logs::LogGroup"
DependsOn: AWSEBBeanstalkMetadata
DeletionPolicy: Retain ## this is required
Properties:
LogGroupName:
"Fn::GetOptionSetting":
Namespace: "aws:elasticbeanstalk:application:environment"
OptionName: ApplicationLogGroup
DefaultValue: {"Fn::Join":["-", [{ "Ref":"AWSEBEnvironmentName" }, "webrequests"]]}
RetentionInDays: 14
cloudwatch 日志组已创建,但没有日志到达。我遗漏了哪些步骤或我的配置文件有什么问题?
【问题讨论】:
标签: amazon-web-services docker amazon-elastic-beanstalk amazon-cloudwatch