turbot/aws_insights

Query: vpc_flow_logs_for_cloudwatch_log_group

Usage

powerpipe query aws_insights.query.vpc_flow_logs_for_cloudwatch_log_group

SQL

with filtered_log_group as (
select
name,
region,
account_id
from
aws_cloudwatch_log_group
where
arn = $1
and region = split_part($1, ':', 4)
and account_id = split_part($1, ':', 5)
)
select
distinct f.flow_log_id
from
aws_vpc_flow_log f
join filtered_log_group g on f.log_group_name = g.name and f.region = g.region
where
f.log_destination_type = 'cloud-watch-logs'
and f.account_id = split_part($1, ':', 5);