Skip to content

Instantly share code, notes, and snippets.

@ejoubaud
Last active March 30, 2017 08:31
Show Gist options
  • Save ejoubaud/bb45283316106393710f4ae607a5ffb9 to your computer and use it in GitHub Desktop.
Save ejoubaud/bb45283316106393710f4ae607a5ffb9 to your computer and use it in GitHub Desktop.
Fetch all available RDS slow logs into single file
aws-vault exec customer -- aws rds describe-db-log-files --db-instance-identifier market-database-clustercluster-16apkpdp1bgkx-us-east-1a --region us-east-1 --query 'DescribeDBLogFiles[].LogFileName' --output text | tr '\t' '\n' | grep slowquery | while read file; do aws-vault exec customer -- aws rds download-db-log-file-portion --db-instance-identifier market-database-clustercluster-16apkpdp1bgkx-us-east-1a --region us-east-1 --log-file-name $file --output text >> slowlogs.log; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment