日志驱动程序 awslogs 需要选项:awslogs-region、awslogs-group

Log driver awslogs requires options: awslogs-region, awslogs-group

我有一个 json 文件,我的 AWS ECS Task definition 喜欢:

[
    {
      "name": "my-name",
      "image": "url",
      "cpu": 2,
      "dnsSearchDomains": null,
      "network_configuration":"awsvpc",
      "entryPoint": null,
      "portMappings": [
        {
          "hostPort": 8080,
          "protocol": "tcp",
          "containerPort": 8080
        }
      ],
      "command": null,
      "linuxParameters": null,
      "environment": [],
      "resourceRequirements": null,
      "ulimits": null,
      "dnsServers": null,
      "mountPoints": [
        {
          "readOnly": null,
          "containerPath": "/fldr",
          "sourceVolume": "fldr"
        }
      ],
      "workingDirectory": null,
      "secrets": null,
      "dockerSecurityOptions": null,
      "memoryReservation": 128,
      "volumesFrom": [],
      "stopTimeout": null,
      "startTimeout": null,
      "firelensConfiguration": null,
      "dependsOn": null,
      "disableNetworking": null,
      "interactive": null,
      "healthCheck": null,
      "essential": true,
      "links": null,
      "hostname": null,
      "extraHosts": null,
      "pseudoTerminal": null,
      "user": null,
      "readonlyRootFilesystem": null,
      "dockerLabels": null,
      "systemControls": null,
      "privileged": null,
      "logConfiguration": {
        "logDriver": "awslogs",
        "awslogs-region": "eu-west-1",
        "awslogs-group": "my-cw-group"
      }
    }
  ]

尽管定义了 awslogs-regionawslogs-group 像这样:

"logConfiguration": {
            "logDriver": "awslogs",
            "awslogs-region": "eu-west-1",
            "awslogs-group": "my-cw-group"
          }

当我运行terraform apply它return:

Error: ClientException: Log driver awslogs requires options: awslogs-region, awslogs-group

我在 Whosebug 中找不到相关问题,Github。

"logConfiguration": {
  "logDriver": "awslogs",
  "options": {
    "awslogs-region": "eu-west-1",
    "awslogs-group": "my-cw-group"
  }
}

这些选项需要是 options 的成员,后者是 logConfiguration 的成员,如上所示。

如果您使用的是 Fargate,您还需要提供 awslogs-stream-prefix,如文档 Specifying a Log Configuration in your Task Definition 中所述。