Skip to main content

MySQL semi-sync cluster logs

For a MySQL semi-sync Managed Database cluster, MySQL service events and slow queries are logged.

Logs can be retrieved using the Logs service. For details on how the service works and its cost, see the Logs service overview instructions. You can check the Logs service availability across locations in the Logs availability by location instructions.

To collect cluster logs in the Logs service, enable logging. You can retrieve logs from the service only via the API. If you no longer need to collect logs, you can disable logging.

Slow query logs can be viewed in the Cloud Databases section of the control panel. You do not need to enable logging in the Logs service to do this.

Logs are stored for 30 days.

For more information about logs, see the MySQL Server Logs section of the MySQL documentation.

Manage logs in the Logs service

Enable logging

You can enable logging via the API or in the Control Panel:

Enable logging in an existing cluster

Logging uses part of the cluster's computing resources. To control the amount of resources consumed, monitor cluster node metrics. For details on how to view metrics, see the Monitoring MySQL semi-sync cluster, nodes, and databases instructions.

  1. In the control panel, in the top menu, click Products and select Managed Databases.
  2. Open the Active tab.
  3. Open the cluster page → Settings tab.
  4. In the Logging block, in the Log service field, click Connect.
  5. Select a log group or create a new group.
  6. If you selected a new group, enter its name.
  7. Click Save.

Get logs

Use the Get logs instructions in the Logs section.

The event streams mysql.log-<instance_id> and slow.log-<instance_id> will be created, where <instance_id> is the node ID of the MySQL semi-sync cluster.

The logged events are defined by the parameter log_error_verbosity = 2, so events of the ERROR and WARNING levels are logged. See the log fields description for the MySQL semi-sync cluster.

Disable logging

  1. In the control panel, in the top menu, click Products and select Cloud Databases.
  2. Open the Active tab.
  3. Open the cluster page → Settings tab.
  4. In the Logging section, in the Log service field, click .
  5. Clear the Collect cluster technical logs into log service checkbox.
  6. Click Save.

View slow query 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 DBMS settings for the long_query_time parameter.

In the logs, you can see what the slow request looked like, its duration, and when and by which user it was executed. Requests can be filtered by time range, cluster nodes, and databases.

  1. In the control panel, in the top menu, click Products and select Cloud Databases.
  2. Open the Active tab.
  3. Open the cluster page → Logs tab.
  4. Enter the time range for which you want to display logs. Logs are stored for 30 days.
  5. Select the cluster nodes and databases for which you want to view logs.
  6. The list displays the first 200 queries. To view all queries for a specified time period, click Download logs. See the log fields description for the MySQL semi-sync cluster.

Log fields

_HOSTNAMECluster node name in the format dbaas-<instance_id>, where <instance_id> is the node ID of the MySQL semi-sync cluster
SYSLOG_IDENTIFIERLog source name
SYSLOG_TIMESTAMPEvent time in the log
MESSAGEDescription of the event submitted by the log source