Home > Software design >  AWS - Will an ECS task store the logs locally and eat up the disk?
AWS - Will an ECS task store the logs locally and eat up the disk?

Time:09-14

I have an ECS cluster newly set up and was wondering if the below configuration will store the logs to the disk even though they are forwarded to CloudWatch:

 "logConfiguration": {
    "logDriver": "awslogs",
    "secretOptions": null,
    "options": {
      "awslogs-group": "logGroupName",
      "awslogs-region": "us-east-1",
      "awslogs-stream-prefix": "PrefixName"
    }
  }

I am just wondering if I still need to create a cronjob to manually clear these logs out from time to time.

Thanks

CodePudding user response:

I am just wondering if I still need to create a cronjob to manually clear these logs out from time to time

No, unless you're writing logs to disk within the application.

A Docker logging driver captures all of the application's StdOut/StdErr output and directs it to the log destination. There is only one logging driver per container, so if you direct to CloudWatch you're not storing locally.

Except, newer versions of the Docker engine support dual logging, which caches recent logs (per linked doc, no more than 100 MB) on the container's local storage.

I don't know what engine AWS uses, or if it disables dual logging entirely, so can't say for sure that it doesn't write any logs to disk. But since those logs are rotated internally, you don't need to create a cronjob to clean them up.

CodePudding user response:

Refer following link it may be helpful to you:

CloudWatch - Delete logs after transfered

  • Related