When the response is delayed, you can view the response time of the SLB instance in the dashboard provided by Log Service. Then you can find unhealthy backend servers.
This topic describes how to use access logs to rapidly find unhealthy backend servers. For more information, see Configure access logging.
Step 1: Configure SLB access logs
- A Layer-7 listener is added.
- Log Service is activated.
- Log on to the Server Load Balancer console.
- In the left-side navigation pane, choose .
- Select the region for the SLB instance.
- Click Authorize, and then click Confirm Authorization Policy to allow SLB to write logs to Log Service.
If you log on to the console as a RAM user, you must first use your Alibaba Cloud account to authorize the RAM user. For more information, see Authorize a RAM user to use access logs.Note If you have authorized SLB, skip this step.
- On the Access Logs page, find the SLB instance and click Configure Logging in the Actions column.
- Configure Project and Logstore and then click OK.
Note Make sure that the name of the Project is globally unique and the region of the Project is the same as that of the SLB instance.
Step 2: View access logs
Perform the following operations:
- Go to the log search page. You can go to the search page from the SLB or Log Service
- From the SLB console
On the Access Logs page, click View Logs.
- From the Log Service console
On the Logstores page, click Search of the Logstore.
- From the SLB console
- Click the log field to view detailed information.
- Enter an SQL statement to query specific access logs.
For example, you can enter the following SQL statement to query the Top20 clients, which is used to analyze the request source and assist business decision-making.
* | select ip_to_province(client_ip) as client_ip_province, count(*) as pv group by client_ip_province order by pv desc limit 50
Step 3: Find unhealthy backend servers
You can find unhealthy backend servers by checking the dashboard of Log Service.
- Log on to the Log Service console and click the project link of the SLB instance.
- In the left-side navigation pane, click .
- Click the link of the SLB access logs.
- In the dashboard, view the value in the top upstream response time tab. You can choose to display the Average upstream response time (s) in descending order to check if the response time of a backend server is more than
If the response time is within one second, run the ssh command to log on to the backend server. Check if the CPU utilization is high and handle the issue if yes.