Storage full issue on AWS RDS

You are surprised by finding out that your RDS server has consumed all the storage space. But when you try to find out the database size and you find that the databases are way less than the total storage.

This happens when you have enabled the general log and slow query log on your RDS server.

You can disable them in the parameter group section and then reboot the server to apply the changes.

But, it does not delete the older logs and the space issue is same as before. I have a solution if your log system stores logs in database instead of files. Just go and check mysql.general_log and mysql.slow_log tables. You may not even able to find out the total rows in it because of so many rows inside them. You can not truncate those table with normal access. RDS does not provide you access to these tables. But we have another way to do this. There are few stored procedures provide by AWS. Just run below queries –

CALL mysql.rds_rotate_slow_log;
CALL mysql.rds_rotate_general_log;

This queries will empty your mysql.general_log and make a backup of it in mysql.general_log_backup table.

Run the queries one more time so that the backup tables also get free up because second time the empty general_log table will be moved to the backup table.

Comments