Rackspace Community

Access slow query and general logs for Cloud Databases

Article ID: 4141

Last updated on December 5, 2014

Authored by: Rosie Contreras

Database logs can be useful tools when analyzing database performance or troubleshooting issues. You can enable logging slow queries or general database activity for a MySQL Cloud Databases instance by attaching a configuration group to the instance with the appropriate parameters set.

To apply configuration groups you will need to enable root access to the database instance. This can be done through the Cloud Databases API or with a trove command:

trove root-enable instanceID

Enable the slow query log

You can use the slow query log to find queries that take a long time to execute and are therefore candidates for optimization. You can access the MySQL slow query log by writing it to a table and setting persistent values to appropriate parameters in your configuration group.

Enable the general query log

You can use the general query log to track all activity, including any connections to the database and all queries sent to the database. It can be useful when you want to check the queries being sent by a client for troubleshooting purposes.