Skip to content

Instantly share code, notes, and snippets.

@koheyamada
Last active April 14, 2017 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koheyamada/f57c60ee78e98c45a3a36a6cc7903df8 to your computer and use it in GitHub Desktop.
Save koheyamada/f57c60ee78e98c45a3a36a6cc7903df8 to your computer and use it in GitHub Desktop.
Amazon RDS のエラーログをCLIで取得する。 ref: http://qiita.com/kooohei/items/3a943d2f844159b80ab0
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1491493558000",
"Effect": "Allow",
"Action": [
"rds:DescribeDBLogFiles",
"rds:DownloadCompleteDBLogFile",
"rds:DownloadDBLogFilePortion"
],
"Resource": [
"*"
]
}
]
}
$ aws rds download-db-log-file-portion --db-instance-identifier rds001 --log-file-name error/mysql-error-running.log.6 --output text
2017-04-06 04:55:08 3372 [Note] Error reading relay log event: slave SQL thread was killed
2017-04-06 04:55:08 3372 [Note] Slave I/O thread killed while connecting to master
2017-04-06 04:55:08 3372 [Note] Slave I/O thread exiting, read up to log 'db001-bin.000002', position 353
2017-04-06 04:55:09 3372 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2017-04-06 04:55:09 3372 [ERROR] Slave I/O: error connecting to master 'repl@10.0.0.205:3306' - retry-time: 60 retries: 1, Error_code: 2003
2017-04-06 04:55:09 3372 [Note] Slave SQL thread initialized, starting replication in log 'db001-bin.000002' at position 353, relay log '/rdsdbdata/log/relaylog/relaylog.001308' position: 236
...
$ aws rds describe-db-log-files --db-instance-identifier rds001 --filename-contains error --output text
DESCRIBEDBLOGFILES 1491469200000 error/mysql-error-running.log 0
DESCRIBEDBLOGFILES 1491436546000 error/mysql-error-running.log.0 63825
DESCRIBEDBLOGFILES 1491440100000 error/mysql-error-running.log.1 62255
DESCRIBEDBLOGFILES 1491404111000 error/mysql-error-running.log.15 72150
DESCRIBEDBLOGFILES 1491407728000 error/mysql-error-running.log.16 72150
DESCRIBEDBLOGFILES 1491411306000 error/mysql-error-running.log.17 70300
DESCRIBEDBLOGFILES 1491414901000 error/mysql-error-running.log.18 71225
DESCRIBEDBLOGFILES 1491418516000 error/mysql-error-running.log.19 68450
DESCRIBEDBLOGFILES 1491443708000 error/mysql-error-running.log.2 62620
DESCRIBEDBLOGFILES 1491422125000 error/mysql-error-running.log.20 67525
DESCRIBEDBLOGFILES 1491425715000 error/mysql-error-running.log.21 65675
DESCRIBEDBLOGFILES 1491429300000 error/mysql-error-running.log.22 65675
DESCRIBEDBLOGFILES 1491432938000 error/mysql-error-running.log.23 65675
DESCRIBEDBLOGFILES 1491447334000 error/mysql-error-running.log.3 61050
DESCRIBEDBLOGFILES 1491450949000 error/mysql-error-running.log.4 61050
DESCRIBEDBLOGFILES 1491454500000 error/mysql-error-running.log.5 59200
DESCRIBEDBLOGFILES 1491458107000 error/mysql-error-running.log.6 59200
DESCRIBEDBLOGFILES 1491461705000 error/mysql-error-running.log.7 58275
DESCRIBEDBLOGFILES 1491465304000 error/mysql-error-running.log.8 56425
DESCRIBEDBLOGFILES 1491468300000 error/mysql-error-running.log.9 45012
DESCRIBEDBLOGFILES 1491491100000 error/mysql-error.log 0
$ aws rds describe-db-log-files --db-instance-identifier rds001
{
"DescribeDBLogFiles": [
{
"LastWritten": 1491455703000,
"LogFileName": "error/mysql-error-running.log",
"Size": 19425
},
{
"LastWritten": 1491436546000,
"LogFileName": "error/mysql-error-running.log.0",
"Size": 63825
},
{
"LastWritten": 1491440100000,
"LogFileName": "error/mysql-error-running.log.1",
"Size": 62255
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment