I have a docker container running in EC2. The logs in the container are written at /var/log. How do I use the awslog driver to get these logs from the container and store it?
Works fine for me.
"Version" "2012-10-17" "Statement" "Action" "logs:CreateLogStream" "logs:PutLogEvents" "Effect" "Allow" "Resource"
mkdir -p /etc/systemd/system/docker.service.d/ touch /etc/systemd/system/docker.service.d/aws-credentials.conf
[Service] Environment"AWS_ACCESS_KEY_ID=<aws_access_key_id>" Environment"AWS_SECRET_ACCESS_KEY=<aws_secret_access_key>"
Reboot docker Host and create an Cloudwatch Logstream
Add this to your docker-compose (v2) to start logging
logging driver "awslogs" options awslogs-region "eu-west-1" awslogs-group "my-group" awslogs-stream "my-stream"
Tested on Ubuntu 15.10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With