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?

asked 6 months ago258 views
2 Answers
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
answered 6 months ago
profile pictureAWS
EXPERT
reviewed 6 months ago
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
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions