Redshift audit log export needs review

Check Redshift audit log coverage, external destinations and retention.

Description

Export Redshift audit logs to S3 or CloudWatch Logs to retain connection and user activity records beyond the database system tables. Those tables still record activity without an external destination.

Potential impact

Short retention can leave gaps when investigating past access. SQL text in logs may contain sensitive values.

Remediation

Set the destination in LoggingProperties and grant log delivery permission. For CloudWatch Logs, select the log types in LogExports. To record SQL activity, also enable enable_user_activity_logging on the cluster. Verify an exported event, such as a new connection for connectionlog. Restrict readers and set retention.

Examples

Supply the subnet group, a RedshiftNodeType supported in the Region and a compatible ClusterType. For a multi-node cluster, specify NumberOfNodes. Provide RedshiftMasterPassword through a NoEcho parameter without a default or an approved secret-management method. Logging does not require PubliclyAccessible: true.

Before

yaml
Resources:
  RedshiftCluster:
    Type: AWS::Redshift::Cluster
    Properties:
      ClusterSubnetGroupName: !Ref RedshiftClusterSubnetGroup
      DBName: analytics
      MasterUsername: admin
      MasterUserPassword: !Ref RedshiftMasterPassword
      PubliclyAccessible: true
      NodeType: !Ref RedshiftNodeType
      Port: 5439

After

yaml
Resources:
  RedshiftCluster:
    Type: AWS::Redshift::Cluster
    Properties:
      ClusterSubnetGroupName: !Ref RedshiftClusterSubnetGroup
      DBName: analytics
      MasterUsername: admin
      MasterUserPassword: !Ref RedshiftMasterPassword
      PubliclyAccessible: true
      NodeType: !Ref RedshiftNodeType
      Port: 5439
      LoggingProperties:
        BucketName: !Ref LoggingBucketName

The second template delivers logs to the S3 bucket named by LoggingBucketName.

References