From 1bf35760eee267854642d4be1404d3f40ce6e3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Thu, 18 Jan 2024 17:15:21 +0100 Subject: [PATCH 1/2] Update CloudFormation template --- .../deployment/cloudformation-template.json | 70 +++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/packages/signed-api/deployment/cloudformation-template.json b/packages/signed-api/deployment/cloudformation-template.json index 22b45fb7..cafabca1 100644 --- a/packages/signed-api/deployment/cloudformation-template.json +++ b/packages/signed-api/deployment/cloudformation-template.json @@ -11,6 +11,21 @@ "Type": "String", "MinLength": 5, "Description": "Auth token for Airnode feed." + }, + "grafanaLokiUser": { + "Type": "String", + "MinLength": 2, + "Description": "Username for authenticating Loki API" + }, + "grafanaLokiToken": { + "Type": "String", + "MinLength": 10, + "Description": "Token for authenticating Loki API" + }, + "grafanaLokiEndpoint": { + "Type": "String", + "MinLength": 10, + "Description": "Loki endpoint" } }, "Outputs": { @@ -40,6 +55,31 @@ "RequiresCompatibilities": ["FARGATE"], "ExecutionRoleArn": { "Ref": "ECSTaskRole" }, "ContainerDefinitions": [ + { + "Essential": true, + "Image": "grafana/fluent-bit-plugin-loki:2.9.1-amd64", + "Name": "SignedApiLogForwarder", + "FirelensConfiguration": { + "Type": "fluentbit", + "Options": { + "enable-ecs-log-metadata": "true" + } + }, + "LogConfiguration": { + "LogDriver": "awslogs", + "Options": { + "awslogs-group": { + "Ref": "SignedApiLogsGroup" + }, + "awslogs-region": { + "Ref": "AWS::Region" + }, + "awslogs-create-group": "true", + "awslogs-stream-prefix": "firelens" + } + }, + "MemoryReservation": 50 + }, { "Name": "signed-api-container", "Image": "", @@ -86,11 +126,33 @@ } ], "LogConfiguration": { - "LogDriver": "awslogs", + "LogDriver": "awsfirelens", "Options": { - "awslogs-group": { "Ref": "SignedApiLogsGroup" }, - "awslogs-region": { "Ref": "AWS::Region" }, - "awslogs-stream-prefix": "ecs" + "Name": "grafana-loki", + "Url": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "grafanaLokiUser" + }, + ":", + { + "Ref": "grafanaLokiToken" + }, + "@", + { + "Ref": "grafanaLokiEndpoint" + }, + "/loki/api/v1/push" + ] + ] + }, + "Labels": "{app=\"signed-api\",airnodeAddress=\"\"}", + "RemoveKeys": "container_id,container_name,ecs_task_definition,source,ecs_cluster", + "LabelKeys": "ecs_task_arn", + "LineFormat": "json" } } } From 8adcdf2758fa04b903fe02a3b478abb9589eca80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Fri, 19 Jan 2024 09:58:50 +0100 Subject: [PATCH 2/2] Use airnode label instead of airnodeAddress --- packages/signed-api/deployment/cloudformation-template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/signed-api/deployment/cloudformation-template.json b/packages/signed-api/deployment/cloudformation-template.json index cafabca1..5c70c12a 100644 --- a/packages/signed-api/deployment/cloudformation-template.json +++ b/packages/signed-api/deployment/cloudformation-template.json @@ -149,7 +149,7 @@ ] ] }, - "Labels": "{app=\"signed-api\",airnodeAddress=\"\"}", + "Labels": "{app=\"signed-api\",airnode=\"\"}", "RemoveKeys": "container_id,container_name,ecs_task_definition,source,ecs_cluster", "LabelKeys": "ecs_task_arn", "LineFormat": "json"