AWS Redshift offers a feature to enable logging for different kinds of activity on the cluster. This allows customers to get logs for all connection attempts made to Redshift, logs on users and on user activity. To set this up, follow the steps below.
Prepare S3 bucket for receiving Redshift logs
First, create a new bucket in which to save the S3 Access Logs. Ideally, this S3 Bucket will have been configured to not allow any deletes and should be in a separate AWS account. Next run the following command to update the bucket policy for this S3 bucket to enable Redshift logging.
Here the file
redshift_logs_bucket_policy.json contains the following (you'll need to fill in the S3 bucket name and the Amazon Redshift Account ID):
Note: The Amazon Redshift Account ID depends on your AWS region and can be found at the link here.
Enable Redshift Logging
Run the following command: