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?

gefragt vor 7 Monaten281 Aufrufe
2 Antworten
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
beantwortet vor 7 Monaten
profile pictureAWS
EXPERTE
überprüft vor 7 Monaten
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
beantwortet vor 7 Monaten

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