Our next-gen architecture is built to help you make sense of your ever-growing data Watch a 4-min demo video!

Back to All Integrations

AWS ECS Fargate Logs AWS ECS Fargate Logs

Last Updated: Apr. 30, 2023

This tutorial demonstrates how to seamlessly collect and send your ECS cluster logs to Coralogix.

Configuration

STEP 1. Run a new AWS ECS Task on your cluster. Select One Task per Host as the Placement Template.

Task run

STEP 2. Create a new ECS Task Definition. It is recommended to switch to the old AWS view and toggle off the New ECS Experience.

STEP 3. Go to the ECS console and choose Task Definitions > Create new task definition.

STEP 4. Under Select launch type compatibility, choose FARGATE and click Next.

STEP 5. Scroll down. Under Log router integration:

  • Tick Enable FireLens integration
  • Type: Select fluentd
  • Image: Write docker.io/coralogixrepo/fluentd-coralogix-ecs:v1.15.2
  • Click Apply

This will add a log_router container to the Containers definitions section.

STEP 6. To create a HEALTHCHECK on the log_router, use the following command:

CMD-SHELL, curl -f http://localhost:24220/api/plugins.json || exit 1

STEP 7. Add to your application container to have two containers on the list.

  • Configure awsfirelens logging driver for the container from which you want to send the logs (testapp container in the example above):
    • Log driver: log driver must be: awsfirelens
    • Log options > @type: null
  • In order to get dynamic values for APP_NAME and SUB_SYSTEM, delete the lines from the Environment variables:
    • APP_NAME value is taken from the field: ecs_cluster
    • SUB_SYSTEM value is taken from the field: container_name
  • Example:
  • Save the changes to the container.
  • Scroll down to the bottom of the page and click Configure via JSON button.
  • Replace fireLensConfiguration
      "firelensConfiguration": {
        "type": "fluentd"
      },

with

      "firelensConfiguration": {
        "type": "fluentd",
        "options": {
          "config-file-type": "file",
          "config-file-value": "/fluentd/etc/firelens.conf"
        }
      },
  • To manage multiline logs, you will need to build this FluentD image while adding a concat filter in the firelens.conf that matches your needs.

Support

Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].

On this page