Amazon ECS Log Collection
Rapport de recherche Datadog : Bilan sur l'adoption de l'informatique sans serveur Rapport : Bilan sur l'adoption de l'informatique sans serveur

Amazon ECS Log Collection

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Setup

To collect all logs written by running applications in your ECS containers and send it to your Datadog application:

  1. Follow the above instructions to install the Datadog Agent.

  2. Update your datadog-agent-ecs.json file datadog-agent-ecs1.json if you are using an original Amazon Linux AMI) with the following configuration:

    {
        "containerDefinitions": [
        (...)
          "mountPoints": [
            (...)
            {
              "containerPath": "/opt/datadog-agent/run",
              "sourceVolume": "pointdir",
              "readOnly": false
            },
            (...)
          ],
          "environment": [
            (...)
            {
              "name": "DD_LOGS_ENABLED",
              "value": "true"
            },
            {
              "name": "DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL",
              "value": "true"
            },
            (...)
          ]
        }
      ],
      "volumes": [
        (...)
        {
          "host": {
            "sourcePath": "/opt/datadog-agent/run"
          },
          "name": "pointdir"
        },
        (...)
      ],
      "family": "datadog-agent-task"
    }
    
  3. Make sure your container definition doesn’t contain a logConfiguration.logDriver parameter, so that the logs are written to stdout/stderr and collected by the Agent. If this parameter is set to awslogs, collect your Amazon ECS logs without the Agent by using AWS Lambda to collect ECS logs from CloudWatch.

  1. Follow the above instructions to install the Datadog Agent.

  2. Update your datadog-agent-ecs-win.json file with the following configuration:

    {
      "containerDefinitions": [
        (...)
          "mountPoints": [
            (...)
            {
              "containerPath": "/etc/passwd",
              "sourceVolume": "passwd",
              "readOnly": true
            },
            (...)
          ],
          "environment": [
            (...)
            {
              "name": "DD_PROCESS_AGENT_ENABLED",
              "value": "true"
            }
          ]
        }
      ],
      "volumes": [
        (...)
        {
          "host": {
            "sourcePath": "/etc/passwd"
          },
          "name": "passwd"
        },
        (...)
      ],
      "family": "datadog-agent-task"
    }
    
  3. Make sure your container definition doesn’t contain a logConfiguration.logDriver parameter, so that the logs are written to stdout/stderr and collected by the Agent. If this parameter is set to awslogs, collect your Amazon ECS logs without the Agent by using AWS Lambda to collect ECS logs from CloudWatch.

Activate log integrations

The source attribute is used to identify the integration to use for each container. Override it directly in your containers labels to start using log integrations. Read Datadog’s Autodiscovery guide for logs to learn more about this process.

Further reading

Documentation, liens et articles supplémentaires utiles: