All Products
Search
Document Center

Simple Log Service:Enable data collection

Last Updated:Jul 17, 2026

CloudLens for PolarDB lets you enable data collection for your PolarDB for MySQL cluster with a single click to collect audit logs, slow query logs, error logs, and metrics.

Prerequisites

You have created a PolarDB for MySQL cluster. For more information, see Purchase a pay-as-you-go cluster or Purchase a subscription cluster.

One-time setup

Important

This is a one-time operation.

  1. Log on to the Simple Log Service console.

  2. In the Log Application section, on the Cloud Service Lens tab, click CloudLens for PolarDB.

  3. Follow the on-screen instructions to enable CloudLens for PolarDB.

    Enabling CloudLens for PolarDB automatically authorizes it to use the service-linked role AliyunServiceRolePolicyForSLSAudit to collect logs and metrics from your PolarDB for MySQL cluster. For more information, see Manage the AliyunServiceRoleForSLSAudit service-linked role.

Enable data collection

  1. Log on to the Simple Log Service console.

  2. In the Log Application section, on the Cloud Service Lens tab, click CloudLens for PolarDB.

  3. On the Data Import Management page, on the PolarDB Cluster Access tab, find the target PolarDB for MySQL cluster and click Enable.

    You can collect audit logs, slow query logs, error logs, and metrics from PolarDB for MySQL clusters. Enable each data type independently as needed.

    Important

    After enabling audit log collection for a PolarDB for MySQL cluster, the SQL Explorer feature is also automatically enabled. You are charged for the SQL Explorer feature based on the storage volume of your audit logs. For more information, see Billable items.

  4. In the confirmation dialog box, click Confirm.

    All metrics from PolarDB for MySQL clusters under your Alibaba Cloud account are collected into a single Metricstore. The first time you enable metrics collection, you must select a destination region. For more information, see Assets.

Related operations

After you enable CloudLens for PolarDB, you can perform the following operations on the Data Import Management page.

Actions

Description

Manage PolarDB for MySQL clusters

CloudLens for PolarDB displays all PolarDB for MySQL clusters under your Alibaba Cloud account.

Click a cluster name to go to the PolarDB console, where you can view cluster details and perform operations such as logging in to a database or migrating data. For more information, see Feature comparison of PolarDB for MySQL 5.6, 5.7, and 8.0.

Disable data collection

To disable data collection, find the target PolarDB for MySQL cluster and click Disable.

Important

Disabling audit log collection does not automatically disable the SQL Explorer feature. If you no longer need to collect audit logs, you must disable the SQL Explorer feature in the Alibaba Cloud PolarDB console. For more information, see Disable SQL Explorer and audit.

Query and analyze data

  • Find the target PolarDB for MySQL cluster and click Log Search. Select the desired log type to navigate to the corresponding Logstore. You can then view the raw logs and perform queries and analysis. For more information, see Quick start for log query and analysis.

  • Find the target PolarDB for MySQL cluster, click Log Search, and select Performance Metrics to navigate to the corresponding Metricstore. You can then view the metric data and perform queries and analysis. For more information, see Query and analyze time series data.

Modify the data retention period

On the Destination Logstores tab, find the target Logstore, click the 修改保存时间 icon to modify its data retention period.

Next steps

View performance monitoring dashboards