Chuong Nguyen
Chuong Nguyen

Reputation: 1162

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?

Upvotes: 3

Views: 3224

Answers (1)

Maxym Skotarenko
Maxym Skotarenko

Reputation: 51

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"
   }
}

Upvotes: 5

Related Questions