Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

3.3. 日志服务

3.3.1. SLB 日志

3.3.1.1. IP 地址查看

			
* | select COALESCE(client_ip, vip_addr, upstream_addr) as source, COALESCE(upstream_addr, vip_addr, client_ip) as dest, sum(request_length) as inflow group by grouping sets( (client_ip, vip_addr), (vip_addr, upstream_addr))			
			
			

3.3.1.2. Top 100 IP 地址

			
*|SELECT client_ip, COUNT(*) as number GROUP by client_ip order by number desc limit 100			
			
			

3.3.1.3. 统计 GET/POST/PUT/DELETE/HEAD/OPTIONS

			
* | SELECT Request_method, COUNT(*) as number GROUP BY Request_method

* | SELECT Request_method, COUNT(*) as number GROUP BY Request_method ORDER BY number DESC  			
			
			

3.3.1.4. 分析接口请求时间

			
(request_uri = '/v2/api')| select  ROUND(request_time) request_time,  count(ROUND(request_time)) count group by  request_time order by  request_time desc limit  1000000

(request_uri = '/v1/api')| select  ROUND(request_time,2) request_time,  count(ROUND(request_time,2)) count group by  request_time order by  request_time desc limit  100000

			
			

3.3.1.5. TOP 20 URL

			
(*)| select  request_uri, count(1) countGROUP by  request_uri ORDER by  count DESC LIMIT  20 			
			
			
			
(slb_vport not 8080 and request_uri not '/v2/api')| select  request_uri, count(1) countGROUP by  request_uri ORDER by  count DESC LIMIT  20 			
			
			

3.3.1.6. QPS

			
* | select time_series(__time__, '100s', '%H:%i:%s', '0') as time, COUNT(1)/100 as QPS GROUP by time ORDER by time LIMIT 1000
* | select time_series(__time__, '10s', '%H:%i:%s', '0') as time, COUNT(1)/10 as QPS GROUP by time ORDER by time LIMIT 1000		
			
			

3.3.2. Kubernetes 日志

3.3.3. Aliyun LOG Java Producer

https://github.com/aliyun/aliyun-log-java-producer