RDSのエラーログ

cliでRDSのログを確認するには、describe-db-log-files

aws rds describe-db-log-files --db-instance-identifier rds001

jsonから、ログのみに変更することも可

aws rds describe-db-log-files --db-instance-identifier rds001 --filename-contains error --output text

エラーログはmysql-error-running.logという名前で1時間ごとに出力される。
エラーログの中身は download-db-log-file-portionというコマンドを使う。

aws rds download-db-log-file-portion --db-instance-identifier rds001 --log-file-name error/mysql-error-running.log.6

– Error logs are written to the mysql-error.log file.
– mysql-error.log is flushed every 5minutes.
– The flushed content is added to mysql-error-running.log
– mysql-error-running.log is rotated hourly.
– Rotaed logs are kept for 24 hours.
– Each log file has UTC time appended to the file name(% H of rotated UTC time)
– Writing to the error log is only performed at startup, at shutdown, and at error detection.

なんだこりゃ、超重要やんけ。