All Products
Search
Document Center

Simple Log Service:Enable data collection

Last Updated:Aug 29, 2023

CloudLens for PolarDB allows you to enable data collection for the audit logs, slow query logs, error logs, and metrics of PolarDB for MySQL clusters with a few clicks. This topic describes how to enable data collection in CloudLens for PolarDB. This topic also describes the operations that you can perform after you enable data collection.

Prerequisites

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

Initially configure CloudLens for PolarDB

Important

You need to perform this operation only once.

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

  3. Enable CloudLens for PolarDB by following the on-screen instructions.

    When you enable CloudLens for PolarDB, the system automatically authorizes CloudLens for PolarDB to assume the service-linked role AliyunServiceRolePolicyForSLSAudit. This allows CloudLens for PolarDB to collect logs and metrics from PolarDB for MySQL. For more information, see Manage the AliyunServiceRoleForSLSAudit service-linked role.

Enable data collection

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

  3. On the PolarDB Cluster Access tab of the Access Management page, find the PolarDB for MySQL cluster and click Enable.

    Simple Log Service allows you to collect the audit logs, slow query logs, error logs, and metrics of a PolarDB for MySQL cluster. You can enable data collection based on your business requirements.

    Important

    After you enable data collection for the audit logs of a PolarDB for MySQL cluster, the SQL Explorer feature is automatically enabled in the cluster. You are charged for the SQL Explorer feature based on the amount of storage that is occupied by audit logs. For more information, see Billable items overview.

  4. In the dialog box that appears, click Confirm.

    Metrics are centrally stored. The collected metrics of all PolarDB for MySQL clusters within the current Alibaba Cloud account are stored in the same Metricstore. The first time you enable data collection for metrics, you must select a region in which you want to store the collected metrics. For more information, see Assets.

What to do next

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

Operation

Description

Manage PolarDB for MySQL clusters

After you enable CloudLens for PolarDB, CloudLens for PolarDB displays all PolarDB for MySQL clusters within your Alibaba Cloud account.

Click a PolarDB for MySQL cluster to go to the Apsara PolarDB console. You can view the details about the cluster. You can also perform other operations. For example, you can log on to a database or migrate a database. For more information, see Features.

Disable data collection

Find a PolarDB for MySQL cluster and click Disable to disable data collection.

Important

If you disable data collection for audit logs, the SQL Explorer feature is not automatically disabled. If you no longer need to collect the audit logs of a PolarDB for MySQL cluster, you can disable the SQL Explorer feature in the Apsara PolarDB console. For more information, see Disable the SQL Explorer and Audit feature.

Query and analyze data

  • Find a PolarDB for MySQL cluster, click Log Query, and then select the type of log that you want to query and analyze to go to the Logstore in which the logs are stored. Then, you can view the raw logs and perform query and analysis on the logs. For more information, see Query and analyze logs.

  • Find a PolarDB for MySQL cluster, click Log Query, and then select Performance Metrics to go to the Metricstore in which the metrics are stored. Then, you can view the raw data of the metrics and perform query and analysis on the metrics. For more information, see Query and analyze metric data.

Modify data retention periods

On the Destination Logstore tab, find a Logstore or a Metricstore and click the Modify Data Retention Period icon to modify the retention period of data in the Logstore or Metricstore.

What to do next

View performance monitoring dashboards