我已经根据这个文档创建了 ECS 集群
我正在使用 CloudFormation 模板:
AWSTemplateFormatVersion: "2010-09-09"
Resources:
# ...
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Sub "${Application}-${Env}"
ExecutionRoleArn:
Fn::ImportValue:
!Sub "${Env}-TaskExecutionRole"
Cpu: 256
Memory: 256
ContainerDefinitions:
- Name: nextjs
Image: nextjs
DependsOn:
- containerName: log_router
condition: START
Essential: true
LogConfiguration:
LogDriver: awsfirelens
Options:
Name: loki
Url: "http://loki.xxx.com/loki/api/v1/push"
Labels: "{job=\"firelens\"}"
RemoveKeys: "container_id,ecs_task_arn"
LabelKeys: "container_name,ecs_task_definition,source,ecs_cluster"
LineFormat: key_value
Links:
- log_router
- Name: nginx
Image: nginx
DependsOn:
- containerName: nextjs
condition: START
Essential: true
PortMappings:
- ContainerPort: 80
LogConfiguration:
LogDriver: awsfirelens
Options:
Name: loki
Url: "http://loki.xxx.com/loki/api/v1/push"
Labels: "{job=\"firelens\"}"
RemoveKeys: "container_id,ecs_task_arn"
LabelKeys: "container_name,ecs_task_definition,source,ecs_cluster"
LineFormat: key_value
Links:
- nextjs
- log_router
- Name: log_router
Image: grafana/fluent-bit-plugin-loki:latest
Essential: true
FirelensConfiguration:
Type: fluentbit
Options:
enable-ecs-log-metadata: true
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: firelens-container
awslogs-region: us-east-1
awslogs-create-group: true
awslogs-stream-prefix: firelens
memoryReservation: 50
所有三个容器都已启动并正在运行,但我在 CloudWatch 中收到以下错误消息:
无法加载输出插件“loki”
截图(对不起,当我将它添加为图像时它失败了):https ://imgur.com/qnE0Cjd
Grafana Loki 是空的
错误在哪里?它可能与DependsOn
或有关Links
吗?