turbot/aws_insights

Query: cloudwatch_log_groups_for_ecs_task_definition

Usage

powerpipe query aws_insights.query.cloudwatch_log_groups_for_ecs_task_definition

SQL

select
g.arn as log_group_arn
from
aws_ecs_task_definition as td,
jsonb_array_elements(container_definitions) as d
left join aws_cloudwatch_log_group as g on g.name = d -> 'LogConfiguration' -> 'Options' ->> 'awslogs-group'
where
d -> 'LogConfiguration' -> 'Options' ->> 'awslogs-region' = g.region
and td.task_definition_arn = $1
and td.account_id = split_part($1, ':', 5)
and td.region = split_part($1, ':', 4);