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
This is a one-time operation.
Log on to the Simple Log Service console.
-
In the Log Application section, on the Cloud Service Lens tab, click CloudLens for PolarDB.
-
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
Log on to the Simple Log Service console.
-
In the Log Application section, on the Cloud Service Lens tab, click CloudLens for PolarDB.
-
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.
ImportantAfter 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.
-
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 |
|
|
Modify the data retention period |
On the Destination Logstores tab, find the target Logstore, click the |
icon to modify its data retention period.