AWS CloudWatch Logs in Docker

+1 vote

I want to use AWS CloudWatch logs in a Kubernetes cluster, where each pod contains a few Docker containers, each deployment would have a separate Log Group, and each container would have a separate stream.
 I could not find a way to send the logging parameters to the docker containers via Kubernetes create / apply.

How can I send the log-driver and log-opt parameters to a Docker container in a pod / deployment?

Setting an AWS CloudWatch Logs driver in docker is done with log-driver=awslogs and log-opt, for example -

#!/bin/bash

docker run \
    --log-driver=awslogs \
    --log-opt awslogs-region=eu-central-1 \
    --log-opt awslogs-group=whatever-group \
    --log-opt awslogs-stream=whatever-stream \
    --log-opt awslogs-create-group=true \
    wernight/funbox \
        fortune




Can anyone helP?

May 29, 2018 in AWS by Flying geek
• 3,150 points
278 views

2 answers to this question.

0 votes

Try using a Helm chart to install Fluentd:

$ helm install --name my-release incubator/fluentd-cloudwatch

Even I tried this from Github, was suggested by an experienced techie, this will help for sure, try this:   https://github.com/kubernetes/charts/tree/master/incubator/fluentd-cloudwatch

answered May 29, 2018 by Cloud gunner
• 4,260 points
0 votes

The awslogs works without using ECS.

you need to configure the AWS credentials (the user should have IAM roles appropriate [cloudwatch logs]).

I used this tutorial, it worked for me: https://wdullaer.com/blog/2016/02/28/pass-credentials-to-the-awslogs-docker-logging-driver-on-ubuntu/

answered Sep 6, 2018 by bug_seeker
• 15,310 points

Related Questions In AWS

+1 vote
2 answers

AWS WAF - Auto Save Web Application Firewall logs in S3.

You can do this through the console ...READ MORE

answered Jul 13, 2018 in AWS by Priyaj
• 56,160 points
279 views
0 votes
1 answer

Pass account id of an AWS sub account using a variable as an argument in CloudWatch Alarm Actions with python (boto3)?

Python String and Integer concatenation >>> print("arn:aws:swf:us-east-2:{0}:action/actions/AWS_EC2.InstanceId.Stop/1.0".format(acccnum)) arn:aws:swf:us-east-2:12312312312312:action/actions/AWS_EC2.InstanceId.Stop/1.0 >>> print("arn:aws:swf:us-east-2:" ...READ MORE

answered Oct 5, 2018 in AWS by Priyaj
• 56,160 points
102 views
+5 votes
2 answers

Can we export/migrate users from AWS cognito, does it cause vendor lock-in?

Cognito actually has the capability to import ...READ MORE

answered Aug 1, 2018 in AWS by bug_seeker
• 15,310 points
651 views
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,160 points
99 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
1,131 views
0 votes
2 answers

Receiving SMS from users and stores in AWS

As far as I know, receiving international ...READ MORE

answered Aug 21, 2018 in AWS by Priyaj
• 56,160 points
55 views