1 Answer
- Newest
- Most votes
- Most comments
1
I got this solved, by having this in my .config file:
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/eb-docker/containers/eb-current-app/*-stdouterr.log
The answer itself is actually not as interesting, as how I got it debugged (posted here in case it will help others):
- SSH into the instance by using
eb ssh
- Found the log: /var/log/awslogs.log and saw the error:
cwlogs.push.stream - WARNING - 6563 - Thread-1 - No file is found with given path '/var/log/containers/*-stdouterr.log'
- I followed the path (/var/log/containers) only to find that the folder structure did not exist. From the logs that was send to cloudwatch, I could see the path was:
/var/log/eb-docker/containers/eb-current-app/
which I checked, and found the log files. - From some of the other questions that I've been reading, I could see that the configuration for awslogs (which is the agent sending output to aws) was located in:
/etc/awslogs/config/stdout.conf
. Looking in this file, I saw the path/var/log/containers/*-stdouterr.log
- I changed the path to
/var/log/eb-docker/containers/eb-current-app/*-stdouterr.log
and restarted the awslogs servicesudo service awslogs restart
Now I could see the log being updated.
Why it did send logs to cloudwatch on deploy, I don't know, but the above fixed the issue
answered 4 years ago
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 10 months ago