turbot/steampipe-mod-aws-compliance

Control: 36 RDS for PostgreSQL DB instances should publish logs to CloudWatch Logs

Description

This control checks whether an Amazon RDS for PostgreSQL DB instance is configured to publish logs to Amazon CloudWatch Logs. The control fails if the PostgreSQL DB instance isn't configured to publish the log types mentioned in the logTypes parameter to CloudWatch Logs.

Database logging provides detailed records of requests made to an RDS instance. PostgreSQL generates event logs that contain useful information for administrators. Publishing these logs to CloudWatch Logs centralizes log management and helps you perform real-time analysis of the log data. CloudWatch Logs retains logs in highly durable storage. You can also create alarms and view metrics in CloudWatch.

Remediation

To publish PostgreSQL DB instance logs to CloudWatch Logs, see Publishing PostgreSQL logs to Amazon CloudWatch Logs in the Amazon RDS User Guide.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.foundational_security_rds_36

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.foundational_security_rds_36 --share

SQL

This control uses a named query:

select
arn as resource,
case
when engine <> 'postgres' then 'skip'
when enabled_cloudwatch_logs_exports ?& array ['postgresql','upgrade'] then 'ok'
else 'alarm'
end as status,
case
when engine <> 'postgres' then title || ' is of ' || engine || ' type.'
when enabled_cloudwatch_logs_exports ?& array ['postgresql','upgrade'] then title || ' logging enabled.'
else title || ' logging disabled.'
end as reason
, region, account_id
from
aws_rds_db_instance;

Tags