Capture container logs in rabbitmq_peer_discovery_aws suite
Using cloudwatch logs
This commit is contained in:
parent
5ede862bc5
commit
51b99544c5
|
|
@ -155,16 +155,22 @@ task_json(Config, RabbitmqConf) ->
|
|||
RabbitmqImage = ?config(rabbitmq_image, Config),
|
||||
RabbitmqErlangCookie = ?config(rabbitmq_erlang_cookie, Config),
|
||||
ServiceName = ?config(ecs_service_name, Config),
|
||||
ClusterName = ?config(ecs_cluster_name, Config),
|
||||
|
||||
{ok, Binary} = file:read_file(filename:join(DataDir, "task_definition.json")),
|
||||
TaskDef = rabbit_json:decode(Binary),
|
||||
|
||||
[RabbitContainerDef, SidecarContainerDef] = maps:get(<<"containerDefinitions">>, TaskDef),
|
||||
LogConfiguration = maps:get(<<"logConfiguration">>, RabbitContainerDef),
|
||||
Options = maps:get(<<"options">>, LogConfiguration),
|
||||
Options1 = Options#{<<"awslogs-stream-prefix">> := list_to_binary(ClusterName)},
|
||||
LogConfiguration1 = LogConfiguration#{<<"options">> := Options1},
|
||||
RabbitContainerDef1 =
|
||||
RabbitContainerDef#{
|
||||
<<"image">> := list_to_binary(RabbitmqImage),
|
||||
<<"environment">> := [#{<<"name">> => <<"RABBITMQ_ERLANG_COOKIE">>,
|
||||
<<"value">> => list_to_binary(RabbitmqErlangCookie)}]
|
||||
<<"value">> => list_to_binary(RabbitmqErlangCookie)}],
|
||||
<<"logConfiguration">> := LogConfiguration1
|
||||
},
|
||||
SidecarContainerDef1 =
|
||||
SidecarContainerDef#{<<"environment">> := [#{<<"name">> => <<"DATA">>,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,15 @@
|
|||
"protocol": "tcp"
|
||||
}
|
||||
],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "awslogs-ecs-peer-discovery-aws",
|
||||
"awslogs-region": "eu-west-1",
|
||||
"awslogs-stream-prefix": "PLACEHOLDER"
|
||||
}
|
||||
},
|
||||
"essential": true,
|
||||
"environment": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue