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?

demandé il y a 7 mois281 vues
2 réponses
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
répondu il y a 7 mois
profile pictureAWS
EXPERT
vérifié il y a 7 mois
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
répondu il y a 6 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions