CloudLens for Redis allows you to enable the log collection feature with a few clicks. You can use CloudLens for Redis to collect the slow query logs, operational logs, and audit logs of Tair (Redis OSS-compatible). This topic describes how to enable the log collection feature. This topic also describes the operations that you can perform after you enable the log collection feature.
Prerequisites
The instance meets the following requirements:
The instance is an Redis Community Edition instance, an Tair Enhanced Edition (Tair)DRAM-based instances, or an Tair Enhanced Edition (Tair)persistent memory-optimized instance.
The instance supports the following architectures:
If Deployment Mode is set to Classic (Local Disk-based), the instance supports all architectures.
If Deployment Mode is set to Cloud-native (Cloud Disk-based), the instance supports only the standard architecture.
Procedure
- Log on to the Log Service console.
In the Log Application section, click the Cloud Service Lens tab. Then, click CloudLens for Redis.
The first time you enable CloudLens for Redis, complete authorization as prompted.
Authorize CloudLens for Redis to use the AliyunServiceRolePolicyForSLSAudit service-linked role to collect the logs of Tair (Redis OSS-compatible). For more information, see Manage the AliyunServiceRoleForSLSAudit service-linked role.
Authorize Tair (Redis OSS-compatible) to assume the service-linked role AliyunServiceRoleForKvstore to access resources in Log Service. For more information, see Service-linked roles.
On the Redis Cluster Access tab of the Access Management page, find the Tair (Redis OSS-compatible) instance and click Enable.
Important
After you click Enable, the log collection feature is enabled for the audit logs, slow query logs, and operational logs of the Tair (Redis OSS-compatible) instance. You can disable the log collection feature only for audit logs. However, you cannot disable the feature for slow query logs or operational logs.
In the Enable Audit Logs Collect dialog box, configure the Retention Period parameter and click Confirm.
Valid values of Retention Period: 1 to 365.
Related operations
The following table describes the operations that you can perform on the Access Management page after you enable CloudLens for Redis.
Operation | Description |
Manage Tair (Redis OSS-compatible) instances | After you enable CloudLens for Redis, CloudLens for Redis displays all Tair (Redis OSS-compatible) instances that meet the specified conditions within your Alibaba Cloud account. Click an Tair (Redis OSS-compatible) instance to go to the Tair (Redis OSS-compatible) console. You can view the details about the instance. You can also perform other operations. For example, you can log on to a database or migrate a database. For more information, see Manage instances. |
Disable the log collection feature | Find an Tair (Redis OSS-compatible) instance and click Disable to disable the log collection feature for audit logs. |
Query and analyze logs | Find an Tair (Redis OSS-compatible) instance, click Index Search, 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. You can view the raw logs and perform query and analysis on the logs. For more information, see Query and analyze logs. |