How to start the cloudwatch agent in container?

后端 未结 5 1567
轮回少年
轮回少年 2021-02-09 02:54

From the docker hub there is an image which is maintained by amazon.

Any one know how to configure and start the container as I cannot find any documen

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-09 03:34

    You just to run the container with log-opt, as the log agent is the main process of the container.

    docker run --log-driver=awslogs --log-opt awslogs-region=us-west-2 --log-opt awslogs-group=myLogGroup amazon/cloudwatch-agent
    

    You can find more details here and here.

    I do not know why you need an agent in a container, but the best practice is to send each container log directly to cloud watch using aws log driver.

    Btw this is entrypoint of the container.

      "Entrypoint": [
             "/opt/aws/amazon-cloudwatch-agent/bin/start-amazon-cloudwatch-agent"
     ],
    

    All you need to call

    /opt/aws/amazon-cloudwatch-agent/bin/start-amazon-cloudwatch-agent
    

提交回复
热议问题