* |select histogram( cast(__TIMESTAMP__ as timestamp),interval 1 minute) as time, count(*) as pv,count( distinct remote_addr) as uv group by time order by time desc limit 10000
计算每分钟各协议类型的 PV:
* |select histogram( cast(__TIMESTAMP__ as timestamp),interval 1 minute) as time, protocol_type, count(*) as pv group by time, protocol_type order by time desc limit 10000
计算每分钟的请求失败率(%):
* |select date_trunc('minute', __TIMESTAMP__) as time, round(sum(case when status =404then1.00else0.00 end)/ cast(count(*) as double)*100,3) as "404比例", round(sum(case when status >=500then1.00else0.00 end)/cast(count(*) as double)*100,3) as "5XX比例", round(sum(case when status >=400 and status <500then1.00else0.00 end)/cast(count(*) as double)*100,3) as "4XX比例", round(sum(case when status >=400then1.00else0.00 end)/cast(count(*) as double)*100,3) as "总失败率" group by time order by time limit 10000