MySQL semi-sync cluster logs
For the MySQL sync cloud database cluster, MySQL service events and slow queries are logged.
Logs can be obtained through the Logi service. For more details on the principle of operation and cost of the service, please refer to the instruction General information about the Logi service. You can see the availability of Logi service in the regions in the Logi availability matrix.
To collect cluster logs in the Logs service, enable logging. You can get logs from the service only through the API. If you no longer need to collect logs, you can turn logging off.
Logs of slow requests can be viewed in the Cloud Databases section of the control panel. You do not need to enable logging in the Logs service for this purpose.
Logs are stored for 14 days.
Read more about logs in the MySQL Server Logs section of the MySQL documentation.
Manage logs in the Logs service
Enable logging
You can enable logging through the API or in the control panel:
- when creating the cluster;
- or in an existing cluster.
Enable logging in an existing cluster
Logging uses a portion of the cluster's computational resources. To control the amount of resources consumed, monitor the cluster node metrics. More information on how to view metrics in the instructionsМониторинг кластера, нод and баз данных MySQL semi-sync.
- In the Dashboard, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- In the Logging block, in the Logging Service field, click Connect.
- Select a log group or create a new group.
- If you have selected a new group, enter its name.
- Click Save.
Get the logs
Use the Get Logs instructions in the Logs section.
Event streams will be created mysql.log-<instance_id> and slow.log-<instance_id>, where <instance_id> is the node ID of the MySQL semi-sync cluster..
Logged events are defined by log_error_verbosity = 2, so ERROR and WARNING level events are logged . See the description of log fields for MySQL semi-sync cluster.
Disable logging
- In the Dashboard, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- In the Logging block, in the Logging Service field, click.
- Uncheck the Collect cluster technical logs to log service checkbox.
- Click Save.
View slow request logs in the control panel
By default, database queries that take longer than two seconds to execute are considered slow. To change this value, change the long_query_time parameter in the DBMS settings.
In the logs you can see what a slow query looked like, its duration, when and which user made it. Queries can be filtered by time interval, cluster nodes and databases.
- In the Dashboard, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Logs tab.
- Enter the time period for which you want to display the logs. Logs are stored for 14 days.
- Mark the cluster and database nodes for which you want to view logs.
- The first 200 requests are displayed in the list. To see all queries for the specified time period, click Download Logs. See the description of log fields for MySQL semi-sync cluster.
Log fields
MySQL
Slow queries