Where are ECS Task logs being stored and for how long?

0

I am running an ECS cluster service powered by EC2. When I log onto the server, which was created with the ECS optimised AMI (AMI ID: ami-040d909ea4e56f8f3) - I can look into the docker logs for the Tasks I have running.

My log options in my Task Definition are:

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

As the logs are being forwarded to CloudWatch, they should be deleted from the instance - am I right? It doesn't make sense that an ECS optimised instance was created without this in mind.

My question simply is - where are these logs stored. Not the agent logs, as I can find the documentation for it, but the actual container logs. And when are they removed from the EC2 instance?

1 Antwort
0
Akzeptierte Antwort

The awslogs driver simply forwards your container STDOUT and STDERR log streams to CloudWatch Logs. It does not read from a specific location in your filesystem. Therefore, your application will need to be configured in such a way that the logs are emitted via the STDOUT and STDERR log streams.

If your application is also writing the logs to a custom location, you will have to perform log rotation to clean up these logs to avoid file system exhaustion.

profile pictureAWS
SUPPORT-TECHNIKER
beantwortet vor 2 Jahren
  • Thanks for getting back to me. Highly appreciated.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen