I have a single container on elastic beanstalk. It's a .net core 2.2 application deployed with a docker container running microsoft/dotnet:2.2-aspnetcore-runtime.
I've been trying to setup logging to cloudwatch, and I went into Elastic Beanstalk -> Environments -> my-environment -> Configuration and enabled "log streaming" (rotate logs is disabled)
I could now see my log's in cloudwatch, and I can see the log statements from my application in: /aws/elasticbeanstalk/my-environment/var/log/eb-docker/containers/eb-current-app/stdouterr.log
The problem is, that they are never updated. The only time more data is put into the logs, is if I redeploy the application (even after 12H, there's still nothing new in the logs).
I've tried adding a file: .ebextensions/logs.config with the content:
option_settings:
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: StreamLogs
value: true
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: DeleteOnTerminate
value: false
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: RetentionInDays
value: 7
But it's the same. The content in the logs is only updated when I redeploy the application. Secondly, I followed this: Elastic Beanstalk Single Container Docker - use awslogs logging driver
option_settings:
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: StreamLogs
value: true
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: DeleteOnTerminate
value: false
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: RetentionInDays
value: 14
files:
"/etc/awslogs/config/stdout.conf":
mode: "000755"
owner: root
group: root
content: |
[/var/log/containers/docker-stdout]
log_group_name=/aws/elasticbeanstalk/`{ "Ref" : "AWSEBEnvironmentName" }`/docker-stdout.log
log_stream_name={instance_id}
file=/var/log/containers/*-stdouterr.log
commands:
"00_restart_awslogs":
command: service awslogs restart
What am I missing? There isn't a lot of traffic on the site, but shouldn't the logs be updated at least every 5 minutes or so? I've been reading about file_fingerprint_lines and setting awslogs as driver on docker, but can't seem to get any of that to work.
I don't have much experience with EBS or Cloudwatch, so any help is highly appreciated. One of the problems is, that I don't really know where to look for debugging this