CloudLens for SLS supports one-click log collection to collect global logs (audit logs, error logs, and metrics) and operational logs.
Enable CloudLens for SLS
This is a one-time operation.
After you enable CloudLens for SLS, SLS collects global logs (audit logs, error logs, and metrics) and operational logs (important logs from the original instance logs and job operational logs) by default. These logs are free of charge.
-
If this is the first time you enable CloudLens for SLS, Global Logs are stored in a project named
log-service-{Alibaba Cloud primary account ID}-{region}, whereregionis the Global Log Storage Region that you select when you enable CloudLens for SLS. Operation Logs are stored in a project namedlog-service-{Alibaba Cloud primary account ID}-{region}, whereregionis the region of the project. For a list of supportedregionvalues, see Usage notes.ImportantIf you delete the project that stores operational logs, SLS automatically creates a new one.
-
If you have already enabled CloudLens for SLS, your existing region and project settings are used.
Procedure
- Log on to the Log Service console.
-
In the Log Application section, click the Cloud Service Lens tab, and then click CloudLens for SLS.
-
On the Data Import Management page, click the SLS Collection Policies tab and follow the on-screen instructions to enable the feature. The system automatically grants the
AliyunServiceRoleForSLSAuditservice-linked role to CloudLens for SLS, allowing it to collect global logs and operational logs. For more information, see Manage the AliyunServiceRoleForSLSAudit service-linked role.
Next steps
Enable billable resource monitoring
In the left-side navigation pane, choose and follow the on-screen instructions to enable Cost Manager. Cost Manager records SLS billable resource data and performs a full update daily. For more information about Cost Manager, see Access.
Create a collection policy

On the SLS Collection Policies > Policies tab, create a collection policy and configure parameters such as Rule Name, Log Type, and Resource Matching Mode.
-
Log Type
-
Operation Logs (Free): Records consumption latency logs for consumer groups in a Logstore, Logtail heartbeat logs, and operational logs for data import, Scheduled SQL, and data shipping jobs. These logs are stored in a Logstore named
internal-diagnostic_login the project. -
Detailed Logs (Billable): Records all logs for resource creation, modification, updates, and deletion within a project, as well as data read/write logs. These logs are stored in a Logstore named
internal-operation_login the project.
-
-
Resource Matching Mode
-
Instance Mode: Select the destination project from the drop-down list.
-
Attribute Mode: Select the destination project by region.
-
Disable, modify, or delete a collection policy
After you enable CloudLens for SLS, SLS automatically creates four built-in collection policies to collect audit logs, metrics, error logs, and operational logs. You cannot disable, modify, or delete the built-in collection policies in the console. However, you can call API operations such as UpsertCollectionPolicy and DeleteCollectionPolicy to adjust them.
-
To suspend log collection for a policy, click Disable in the Status column. This action stops the collection of new logs.
-
To change the Resource Matching Mode for a policy, click Modify in the Actions column.
-
To delete a policy, click Delete in the Actions column.
View project details
The SLS Collection Policies > Instances tab lists all projects in your account. Click a project name to view its details page.
Reset an index
At the top of the page, click the Destination Logstores tab to view all Logstores that are configured as destinations for data shipping.
-
Click the name of a destination Logstore to go to the project details page.
-
Find the destination Logstore and click Reset in the Index Reset column to revert the index to the latest built-in version.
Resetting the index reverts it to the latest built-in version, deletes your custom index, and applies the changes only to new data.