Amazon ECS Log File in Fargate

0

I'm migrating from ecs with ec2 to ecs with fargate and have a question In case of ecs with ec2, we emit ECS log like ecs-agent.log, evs-init.log Are these also available in Fargate? If not, container insight is something similar to these?

preguntada hace 7 meses281 visualizaciones
2 Respuestas
0

As the underlying Platform Version (compute) is fully managed by Fargate, the ECS Agent is not available. Please see the following resources on ECS Fargate container logging options and Observability on ECS/Fargate

AWS
respondido hace 7 meses
profile pictureAWS
EXPERTO
revisado hace 7 meses
0

ecs-agent.log and ecs-init.log are ECS Agent log files.

You don't need to care about them while using Fargate since it is a managed service.

Regarding the application log, you need to configure the logging driver inside of your task definition.

Also, need to send the application logs to the STDOUT/STDERR. Most of the container images are doing it by default. If you are creating your own image, make sure that the main process is not writing the logs in a file instead.

The logging configuration would be similar to this below:

{
    "containerDefinitions": [
                 (...)
                "logConfiguration": {
                        "logDriver": "awslogs",
                         "options": {
                                "awslogs-create-group": "true",
                                "awslogs-group": "awslogs-mysql",
                                 "awslogs-region": "us-west-2",
                                "awslogs-stream-prefix": "awslogs-example",
                                "mode": "non-blocking", 
                                "max-buffer-size": "25m" 
                }
            (...)

You can find more information about awslogs driver configuration on this documentation.

profile pictureAWS
respondido hace 7 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas