简体   繁体   中英

Is there a way to rotate logs in AWS ECS through task definition configuration?

I'm running datadog agent container in EC2 by configuring task definition in AWS ECS.

But at this time, the huge amount of logs is stored in /var/lib/docker/containers/ ContainerID / ContainerID .json so that I want to rotate it.

In Docker documents, I saw this link .

There are

  "log-opts": {
    "max-size": "10m",
    "max-file": "3"

Now I want to config these options through task definition but I don't know the convention of them. Did anyone have any ideas?

If you put in ECS Task Definition (sample from json version, but in UI also possible to setup), you should be able to configure container logs:

"logConfiguration": {
   "logDriver": "json-file",
   "options": {
       "max-size": "10m",
       "max-file": "3"
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM