Cloud Load Balancer (CLB) is a product of hundreds of billions of QPS and relies heavily on refined operation. Access logs provided by Cloud Log Service (CLS) are key to refined operation. You can go to CLB > Access Logs to mine the value of massive amounts of access log data. By analyzing access logs, you can monitor client requests, troubleshoot issues, and analyze user behaviors to provide data support for refined operation. This document introduces how to use CLS to analyze CLB access logs.
Jack is in charge of the OPS of the advertising platform of an internet business. He received feedback from an advertising partner complaining that, when users click on an advertisement on the platform, the advertisement opens very slowly. The advertising partner has high requirements for timeliness and stability and proposed that if the service experiences an exception, an alarm should be generated within 1 minute and solved within 5 minutes. To meet this requirement, CLB logs can be used to implement the following capabilities:
Based on the 1-minute real-time alarms and multidimensional analysis capabilities of CLS, you can quickly monitor CLB access logs to locate and rectify faults.
* | select time_series(__TIMESTAMP__, '1m', '%Y-%m-%d %H:%i:%s', '0') as time, round(avg(request_time)*1000,2) as "Average access latency" group by time order by time limit 1000
status:>200 | select time_series(__TIMESTAMP__, '1m', '%Y-%m-%d %H:%i:%s', '0') as time, status, count(1) group by time,status order by time limit 1000
Configure an alarm policy to detect alarms whose average latency per minute is higher than a specified threshold
Configure multidimensional analysis in the alarm policy to obtain additional information when an alarm occurs
Once an alarm is triggered, you can receive alarm information and details through channels such as WeChat, WeCom, SMS, and phone.
Alarm details include information such as affected RS and LB instances.
It can be seen that the average latency of LB instances is relatively high and the LB instance most affected is
9.*****.1. In this way, Jack can quickly locate the exceptional LB instance and restore it. The entire process takes only 1 minute.
Jane, responsible for operating a technology content app, needs to plan an offline salon next month to increase the stickiness of existing users and take the opportunity to promote products and attract new users. Due to the short preparation time and limited funds, in order to achieve the KPI target, Jane lists the following information that needs to be obtained:
Analyzing CLB access logs helps Jane solve operations statistics problems with ease.
Use the IP function provided by CLS to convert client IPs to the corresponding provinces or countries.
* | select count(1) as c, ip_to_province(remote_addr) as address group by address limit 100
* | select count(1) as c, ip_to_country(remote_addr) as address group by address limit 100
http_host field records request domain names. By calculating the PV and UV of request domain names, you can sort out top hosts.
* | select http_host, count(*) as pv, approx_distinct(remote_addr) as uv group by http_host order by pv desc limit 100
* | select http_user_agent, count(*) group by http_user_agent
http_referer records the request sources of the website.
* | select http_referer, count(*) as count group by http_referer order by count desc limit 100
By analyzing CLB access logs, you can obtain various valuable results, such as PV and UV trends, client packet traffic statistics, status code distribution, and p99 and p95 access latency statistics. To help you quickly analyze CLB access logs, CLS and CLB have jointly created a visual analysis scheme out of the box. You can enjoy it immediately by enabling the feature of shipping CLB access logs to CLS.