I think most of the time people just go to the console and download a single log. Maybe two or three?
Well, I needed to download lot’s of them.
This is something I would never do it over the console …
So here is my script to bulk download logs from AWS RDS:
First list all logs available:
aws rds describe-db-log-files --db-instance-identifier production-db > slowlogs-production.log
Then use grep to download only the ones needed:
for a in `grep slowquery slowlogs-production.log | awk '{ print $3 }' | grep -v 2023-05-30 | cut -d '/' -f2`
do
aws rds download-db-log-file-portion \
--db-instance-identifier production-db \
--starting-token 0 --output text \
--log-file-name slowquery/$a > $a
done
Hope it helps.