Download RDS logs

The easer way to grab your RDS logs

db_instance="awesome_db_identifier"
aws_profile="corp_aws_profile"

for logfile in $(aws --profile=${aws_profile} rds describe-db-log-files --db-instance-identifier ${db_instance} --query "DescribeDBLogFiles[].LogFileName"  |jq -r '.|@sh'); do
  echo $logfile
  name=$(echo $logfile|tr -d "'")
  aws rds --profile=${aws_profile} download-db-log-file-portion --db-instance-identifier ${db_instance} --log-file-name "${name}" --starting-token 0 --output text >> $(echo "${name}" |tr '/' '_').log
done 

Do you have any question to us?

Contact us and we'll get back to you as soon as possible.