Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleRDS/MySQL logging facilities
# enable general log (assumes "loadtest-edx-mysql56-prod-snap-11.11-with-query-log" is the name of the parameter group)
rds-modify-db-parameter-group loadtest-edx-mysql56-prod-snap-11.11-with-query-log --parameters "name=general_log,value=ON,method=immediate"

# retrieve general log
echo 'select * from mysql.general_log' | ssh pwnage101@tools-gp.edx.org mysql -u read_only -h "<hostname_of_db>" >output.csv

# retrieve binlog (must be root user)
first_binlog=$(ssh tools-gp.edx.org mysql -u root -h "<hostname_of_db>" -e 'show binary logs;' --skip-column-names | head -n 1)
ssh tools-gp.edx.org mysqlbinlog --raw --result-file=/tmp/binlogs/ --read-from-remote-server --to-last-log -u root -h "<hostname_of_db>" "$first_binlog"

# view binlog locally
scp -r tools-gp.edx.org:/tmp/binlogs .
mysqlbinlog binlogs/*

...