I have an Elastic Beanstalk application deployed with a Docker container. The application itself is a Java Application.
My goal is to get the logs to Cloudwatch. In particular I would like to get the stdouterr.log file to Cloudwatch. The file can be found under /var/log/eb-docker/containers/eb-current-app/*
I followed the official AWS documentation here. Based on the example configuration files I managed to get the nginx Webrequest to Cloudwatch.
For the EB docker stdouterr log I adapted the cwl-log-setup.config file to the following:
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
The cloudwatch log group is created but no logs arrive. What steps am I missing or what is wrong in my configuration file?