DEV Community

Dmitry Romanoff
Dmitry Romanoff

Posted on

1

How to download AWS RDS Postgres log files?

The following bash script downloads AWS RDS Postgres log files, appending them to one single file. It uses aws-cli.

the_region="us-east-1"
the_db_instance="my-db-instance"

for filename in $( aws rds describe-db-log-files --region $the_region --db-instance-identifier $the_db_instance | jq -r '.DescribeDBLogFiles[] | .LogFileName' )
do
aws rds download-db-log-file-portion --region $the_region --db-instance-identifier $the_db_instance --output text --no-paginate --log-file $filename  >> /tmp/postgres_aws_rds_logs_$the_db_instance.log
done
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay