This topic describes how to enable access logs on the Server Load Balancer (SLB) console to collect Layer 7 access logs from Classic Load Balancer (CLB) instances and store them in Log Service.
Prerequisites
-
You have created a Classic Load Balancer (CLB) instance. For more information, see Create an instance.
-
You have configured a Layer 7 listener, such as an HTTP listener or an HTTPS listener, for the CLB instance. For more information, see Add an HTTP listener or Add an HTTPS listener.
-
You have created a Log Service project and Logstore in the same region as your CLB instance. For more information, see Create a project and a Logstore.
Procedure
If you use a RAM user to enable access logs, you must first grant the required permissions to the RAM user. For more information, see Authorize a RAM user.
-
Log in to the SLB console.
-
In the top-left corner of the page, select a region.
-
In the left-side navigation pane, choose .
-
Follow the on-screen instructions to authorize Classic Load Balancer to assume the
AliyunLogArchiveRolerole to access Log Service.This operation is required only when you configure access logs for the first time and you must use an Alibaba Cloud account to complete it.
WarningDo not revoke the authorization or delete the
AliyunLogArchiveRolerole. Otherwise, CLB cannot send access logs to Log Service. -
On the Access Log (Layer 7) page, find the target instance and click Configure in the Actions column.
-
In the Configure Logging panel, select an available project and Logstore, and then click OK.
After the configuration is complete, Log Service creates indexes for the selected Logstore by default. If the Logstore already has indexes, Log Service overwrites them.
Related operations
|
Actions |
Description |
|
Query access logs |
On the Access Log (Layer 7) page, find the target instance, and then click View Logs in the Actions column. For more information, see Query access logs. |
|
Disable access logs |
On the Access Log (Layer 7) page, find the target instance, and then click Delete in the Actions column. For more information, see Disable access logs. Important
Disabling the access log feature does not automatically delete the project or the logs that have been sent. To avoid unnecessary fees after disabling this feature, delete the corresponding project on the Log Service console. For more information, see Manage projects. |
Next steps
After Layer 7 access logs from your CLB instance are sent to Log Service, you can perform various operations on the Log Service console, such as querying, analyzing, downloading, shipping, and processing the logs, or creating alerts. For more information, see Common operations on logs of Alibaba Cloud services.