Audit access in Amazon Redshift by enabling user-activity logging and querying STL/SVL system tables to see who logged in and which tables they touched.
Redshift access auditing captures login events and query activity so you can see who accessed what data and when.
Set enable_user_activity_logging = true
in the cluster parameter group, configure an S3 log destination, then reboot. Redshift starts writing connection, user, and query logs to STL tables and copies them to S3 every five minutes.
stl_connection_log
stores successful logins, stl_userlog
captures failed logins, svl_qlog
details table-level reads/writes, and svl_statementtext
holds full SQL text. Join these tables for complete visibility.
SELECT event_time, username, remotehost, ssl FROM stl_connection_log WHERE event_time >= dateadd('hour',-24,current_timestamp) ORDER BY event_time DESC;
SELECT username,starttime,query FROM svl_qlog WHERE tbl = (SELECT oid FROM pg_table_def WHERE tablename='customers') AND starttime >= dateadd('day',-1,current_timestamp);
The query below groups yesterday’s reads on Customers
so you can spot outliers quickly.
Unload or copy audit logs to S3 daily, retain at least 90 days, monitor stl_userlog
for repeated failures, and stream logs to CloudWatch/SIEM for real-time alerts.
Not enabling logging: STL/SVL tables stay empty. Fix by turning on enable_user_activity_logging
and rebooting.
Ignoring retention: STL tables purge after a few days. Schedule nightly UNLOAD
jobs or automate S3 exports.
Galaxy’s AI copilot can generate these audit queries instantly, let you endorse them in Collections, and share with security teams—no more copy-pasting SQL in Slack.
Minimal impact. Logging writes lightweight metadata asynchronously. Query performance remains unchanged for typical workloads.
STL/SVL tables keep 2–5 days depending on cluster size. S3 copies persist until you delete or lifecycle-expire them.
Yes. Configure Redshift to export logs to CloudWatch via the console or AWS CLI for centralized monitoring and alerting.