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 Resposta
0
Resposta aceita

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
ENGENHEIRO DE SUPORTE
respondido há 2 anos
  • Thanks for getting back to me. Highly appreciated.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas