All Products
Search
Document Center

PolarDB:Subscribe to the PolarDB for MySQL cluster logs

Last Updated:Mar 28, 2026

PolarDB log subscription delivers all PolarDB for MySQL cluster logs to a central project in Simple Log Service (SLS) for centralized management and analysis. This topic explains how to enable, view, and disable log collection.

Prerequisites

Before you begin, make sure that:

  • Your cluster is a PolarDB for MySQL cluster

  • To collect audit logs, SQL Explorer is enabled for the cluster. SQL Explorer is billed based on audit log storage size.

Note

SQL Explorer is not required if you only collect slow query logs or performance logs.

Supported log types

  • Audit logs

  • Slow query logs

  • Error logs

  • Performance logs

Enable log collection

  1. Log on to the Simple Log Service console.

  2. In the Log Application section, select the Audit & Security tab and click Log Audit Service.

    Log Audit Service entry

  3. Configure authorization for log collection and synchronization.

  4. Choose Access to Cloud Products > Global Configurations, then complete the following settings:

    1. In the Region of the Central Project drop-down list, select the region where you want to store collected logs. 全局配置 The system automatically creates a central project in the selected region. All logs configured in the following steps are delivered to this project. The project name follows the format slsaudit-center-<Alibaba Cloud account ID>-<region ID>. For more information, see Project.

    2. Select the log types to collect: Audit Logs, Slow Query Logs, Error Logs, or Performance Logs. image

    3. Click Collection Policy next to each log type you want to collect. In the Collection Policy Configuration dialog box, add the regions where your clusters reside. If no region is specified, the system creates a Logstore for each region. For more information, see Logstore and Configure log collection policies.

      The following parameters are available in collection policies for PolarDB for MySQL clusters:

      ParameterDescriptionExample
      account.idAlibaba Cloud account ID that the cluster belongs to
      regionRegion where the cluster is deployedcn-hangzhou
      cluster.idCluster ID
      cluster.nameCluster name
      cluster.db_typeDatabase type (only MySQL is supported)MySQL
      cluster.db_versionDatabase version8.0, 5.7, or 5.6
      tag.*Tag name. Replace * with a custom tag name. See Add tags.

      Click OK after completing the configuration.

    4. Click Save in the upper-right corner.

      Note

      Changes take effect in about 2 minutes. If an error occurs, follow the on-screen instructions to update the configuration.

      image

  5. In the confirmation dialog box, click Go to Access Status to verify that log collection is active. Alternatively, choose Access to Cloud Products > Status Dashboard in the navigation pane to check the collection status for each log type.

View collected logs

  1. Log on to the Simple Log Service console.

  2. On the Global Configurations tab, click the central project. The project name follows the format slsaudit-center-<Alibaba Cloud account ID>-<region ID>.

    Central project link

  3. Select the Audit Query tab, then click PolarDB to expand the Logstore and view log details.

    Audit query view

Disable log collection

  1. Disable the PolarDB log collection feature. See What to do next.

    Note

    Changes take effect in about 2 minutes.

  2. Open Cloud Shell.

  3. Run the following command to delete the Logstore:

    Important

    This operation deletes all data from a project. Proceed with caution.

    aliyunlog log delete_project --project_name=<project name> --region-endpoint=<region ID>.log.aliyuncs.com

Log fields

For a full list of log fields, see The fields of PolarDB for MySQL logs.