turbot/aws_insights

Query: rds_db_instance_logging_status

Usage

powerpipe query aws_insights.query.rds_db_instance_logging_status

Steampipe Tables

SQL

with logging_enabled as (
select
db_instance_identifier as name
from
aws_rds_db_instance
where
(engine like any (array ['mariadb', '%mysql']) and enabled_cloudwatch_logs_exports ?& array ['audit','error','general','slowquery'] )or
( engine like any (array['%postgres%']) and enabled_cloudwatch_logs_exports ?& array ['postgresql','upgrade'] ) or
( engine like 'oracle%' and enabled_cloudwatch_logs_exports ?& array ['alert','audit', 'trace','listener'] ) or
( engine = 'sqlserver-ex' and enabled_cloudwatch_logs_exports ?& array ['error'] ) or
( engine like 'sqlserver%' and enabled_cloudwatch_logs_exports ?& array ['error','agent'] )
),
logging_status as (
select
case
when l.name is not null then 'enabled'
else 'disabled' end as db_instance_logging_status
from
aws_rds_db_instance as i
left join logging_enabled as l on i.db_instance_identifier = l.name
)
select
db_instance_logging_status,
count(*)
from
logging_status
group by
db_instance_logging_status;

Dashboards

The query is used in the dashboards: