In this blog, we discuss How to enable General Logs and Error Logs in AWS RDS.
You can monitor Mysql General logs and Error logs directly through the Amazon RDS console, the Amazon RDS API, the Amazon RDS CLI, or the AWS SDKs.
MySQL Error Logs
The MySQL error log file is generated by default. It is written to mysql-error.log file. MySQL writes to the error log only on startup, shutdown, and when it encounters errors
It records all information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld.
You can enable general logs by setting parameters in a DB Parameters groups that you have created for your MySQL instance.
Steps to modify DB Parameter Group
- Login to AWS Management Console
- Goto RDS Service
- In the navigation pane, choose Parameter Groups. The available DB parameter groups appear in a list.
- In the list, select the parameter group you want to modify.
- Choose Edit Parameters and set the following parameters to the specified values:
General_log = 1 (default is 0 or no logging)
Choose any one logging method:
log_output=FILE, to allow viewing the logs from the console.
log_output=TABLE, to allow viewing logs with a query.
- Choose Save Changes.
It is advisable to enable general log only if you are actively troubleshooting issues. General log captures all SQL statements received from the client. If it is enabled and left unchecked, it will quickly grow and end up utilizing most of your storage. I would recommend turning this parameter OFF if you are not actively troubleshooting for errors from client connections.
Read this also: