非200请求
关键词
Nginx访问分析,通用聚合分析,错误分析
相关函数
round,compare,count_if,count
用count_if函数,统计status大于200的数量,用总量比,得出失败比例, 用compare函数,表示将当前时段计算出来的失败比例值和86400秒之前计算出来的结果进行比较。 返回为一个数组,第一个为当前值,第二个为86400秒之前值,第三个为当前时段与之前时段的比值, 用单值图展示,显示值设置为today,对比值设置为growth。
SQL
* |
select
round(diff [1], 2) as today,
round((diff [3] -1.0) * 100, 2) as growth
FROM
(
SELECT
compare(fail, 86400) as diff
from
(
select
count_if(status > 200) * 1.0 / count(1) as fail
from
log
)
)