更新时间:2024-11-18 GMT+08:00

APIG仪表盘模板

APIG(API Gateway)提供高性能、高可用、高安全的API托管服务,能快速将企业服务能力包装成标准API服务,帮助您轻松构建、管理和部署任意规模的API,并上架API云商店进行售卖。借助API网关,可以简单、快速、低成本、低风险地实现内部系统集成、业务能力开放及业务能力变现。API网关帮助您变现服务能力的同时,降低企业研发投入,让您专注于企业核心业务,提升运营效率。

APIG仪表盘模板支持查看APIG访问中心查看APIG监控中心分析APIG秒级监控

前提条件

查看APIG访问中心

  1. 登录云日志服务控制台,在左侧导航栏中选择“仪表盘”。
  2. 在仪表盘模板下方,选择“APIG仪表盘模板 > APIG访问中心”,查看图表详情。

    • 过滤请求域名,所关联的查询分析语句如下所示:
      select distinct(host)
    • 过滤app_id,所关联的查询分析语句如下所示:
      select distinct(app_id)
    • 访问量PV分布(世界)图表所关联的查询分析语句如下所示:
      SELECT ip_to_country(my_remote_addr) as country,sum(ori_pv) as PV from (select my_remote_addr, count(1) as ori_pv 
        group by my_remote_addr  
        ORDER BY ori_pv desc 
        LIMIT 10000) GROUP BY country HAVING country not in ('','保留地址','*')
    • 平均时延分布(中国)所关联的查询分析语句如下所示:
      SELECT province,round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)"FROM (SELECT ip_to_province(my_remote_addr) as province,sum(rt)/sum(ori_pv) * 1000 AS "平均延迟(ms)" from (select my_remote_addr, sum(request_time) as rt,count(1) as ori_pv 
        group by my_remote_addr  
        ORDER BY ori_pv desc 
        LIMIT 10000) WHERE  IP_TO_COUNTRY (my_remote_addr) = '中国' GROUP BY province )
        where province not in ('','保留地址','*')
    • 平均时延分布(世界)所关联的查询分析语句如下所示:
      SELECT country,round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 2 ) AS "平均延迟(ms)"FROM (SELECT ip_to_country(my_remote_addr) as country,sum(rt)/sum(ori_pv)  * 1000 AS "平均延迟(ms)" from (select my_remote_addr, sum(request_time) as rt,count(1) as ori_pv 
        group by my_remote_addr  
        ORDER BY ori_pv desc 
        LIMIT 10000) GROUP BY country )
      where  country not in ('','保留地址','*')
    • 今日PV/UV所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss' ) as _time_,PV,UV FROM (select TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT600S') AS _time_ , count(1) as PV,  APPROX_COUNT_DISTINCT(my_remote_addr) as UV from log WHERE __time <= CURRENT_TIMESTAMP  and __time >= DATE_TRUNC( 'DAY',(CURRENT_TIMESTAMP + INTERVAL '8' HOUR)) - INTERVAL '8' HOUR group by _time_ order by _time_)
    • 区域访问TOP10(省份)所关联的查询分析语句如下所示:
      select ip_to_province(my_remote_addr) as "province", sum(ori_pv) as "访问次数" from(select my_remote_addr, count(1) as ori_pv 
        group by my_remote_addr  
        ORDER BY ori_pv desc 
        LIMIT 10000)group by "province" HAVING "province" <> '-1' order by "访问次数" desc limit 10
    • 区域访问TOP10(城市)图表所关联的查询分析语句如下所示:
      select ip_to_city(my_remote_addr) as "city", sum(ori_pv) as "访问次数" from(select my_remote_addr, count(1) as ori_pv 
        group by my_remote_addr  
        ORDER BY ori_pv desc 
        LIMIT 10000) group by "city" HAVING  "city" <> '-1' order by "访问次数" desc  limit 10
    • Host访问TOP10图表所关联的查询分析语句如下所示:
      select  host as "Host", count(1) as "PV" group by "Host" order by "PV" desc limit 10
    • UserAgent访问TOP10图表所关联的查询分析语句如下所示:
      select http_user_agent as "UserAgent", count(1) as "PV" group by "UserAgent" order by "PV" desc limit 10
    • 设备占比(终端)图表所关联的查询分析语句如下所示:
      select case when regexp_like(lower(http_user_agent), 'iphone|ipod|android|ios') then '移动端' else 'PC端' end as type , count(1) as total group by  type
    • 设备占比(系统)图表所关联的查询分析语句如下所示:
      select case when regexp_like(lower(http_user_agent), 'iphone|ipod|ios') then 'IOS' when regexp_like(lower(http_user_agent), 'android') then 'Android' else 'other' end as type , count(1) as total group by  type HAVING type != 'other'
    • TOP URL图表所关联的查询分析语句如下所示:
      select router_uri , count(1) as pv, APPROX_COUNT_DISTINCT(my_remote_addr) as UV, round(sum( case when status < 400 then 1 else 0 end   )  * 100.0 / count(1), 2) as "访问成功率" group by router_uri ORDER by pv desc
    • TOP 访问IP图表所关联的查询分析语句如下所示:
      select my_remote_addr as "来源IP",ip_to_country(my_remote_addr) as "国家",ip_to_province(my_remote_addr) as "省份",ip_to_city(my_remote_addr) as "城市",ip_to_provider(my_remote_addr) as "运营商",count(1) as "PV" group by my_remote_addr ORDER by "PV" desc limit 100

查看APIG监控中心

  1. 登录云日志服务控制台,在左侧导航栏中选择“仪表盘”。
  2. 在仪表盘模板下方,选择“APIG仪表盘模板 > APIG监控中心”,查看图表详情。

    • 过滤请求域名,所关联的查询分析语句如下所示:
      select distinct(host)
    • 过滤app_id,所关联的查询分析语句如下所示:
      select distinct(app_id)
    • 访问量PV图表所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss' ) as _time_,PV FROM ( SELECT TIME_CEIL ( TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'), 'PT300S' ) AS _time_, count( 1 ) AS PV FROM log GROUP BY _time_ )
    • 请求成功率图表所关联的查询分析语句如下所示:
      select ROUND(sum(case when status < 400 then 1 else 0 end) * 100.0 / count(1),2) as cnt
    • 平均延迟图表所关联的查询分析语句如下所示:
      select round(avg(request_time) * 1000, 3) as cnt
    • 4XX请求数图表所关联的查询分析语句如下所示:
      SELECT COUNT(1) as cnt WHERE "status" >= 400 and "status" < 500
    • 404请求数图表所关联的查询分析语句如下所示:
      SELECT COUNT(1) as cnt WHERE "status" = 404
    • 429请求数图表所关联的查询分析语句如下所示:
      SELECT COUNT(1) as cnt WHERE "status" = 429
    • 504请求数图表所关联的查询分析语句如下所示:
      SELECT COUNT(1) as cnt WHERE "status" = 504
    • 5XX请求数图表所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss') as _time_,cnt FROM ( SELECT TIME_CEIL ( TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'), 'PT300S' ) AS _time_, count( 1 ) AS cnt FROM log where "status" >= 500 GROUP BY _time_ )
    • 状态码分布图表所关联的查询分析语句如下所示:
      SELECT status, COUNT(1) AS rm GROUP BY status
    • 访问量UV图表所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss' ) as _time_,UV FROM (select TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT600S') AS _time_ , APPROX_COUNT_DISTINCT(my_remote_addr) as UV  from log group by _time_)
    • 流量图表所关联的查询分析语句如下所示:
      select TIME_FORMAT(_time_,'yyyy-MM-dd HH:mm:ss') AS _time_,round( CASE WHEN "入流量" > 0 THEN "入流量" ELSE 0 END, 2 ) AS "入流量",round( CASE WHEN "出流量" > 0 THEN "出流量" ELSE 0 END, 2 ) AS "出流量" FROM (SELECT TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT600S') AS _time_,sum(request_length) / 1024.0 AS "入流量",sum(bytes_sent) / 1024.0 AS "出流量" group by  _time_)
    • 访问失败率图表所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss') as _time_,round( CASE WHEN "失败率" > 0 THEN "失败率" ELSE 0 END, 2 ) AS "失败率",round( CASE WHEN "5XX比例" > 0 THEN "5XX比例" ELSE 0 END, 2 ) AS "5XX比例" from (select TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT600S') AS _time_,sum(case when status >= 400 then 1 else 0 end) * 100.0 / count(1) as '失败率' , sum(case when status >=500 THEN 1 ELSE 0 END)*100.0/COUNT(1) as '5XX比例' group by  _time_)
    • 延迟图表所关联的查询分析语句如下所示:
      select TIME_FORMAT( _time_, 'yyyy-MM-dd HH:mm:ss') as _time_,round( CASE WHEN "平均" > 0 THEN "平均" ELSE 0 END, 2 ) AS "平均",round( CASE WHEN "P50" > 0 THEN "P50" ELSE 0 END, 2 ) AS "P50",round( CASE WHEN "P90" > 0 THEN "P90" ELSE 0 END, 2 ) AS "P90",round( CASE WHEN "P99" > 0 THEN "P99" ELSE 0 END, 2 ) AS "P99",round( CASE WHEN "P9999" > 0 THEN "P9999" ELSE 0 END, 2 ) AS "P9999" from (select TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT600S') as _time_,avg(request_time) * 1000 as "平均", APPROX_QUANTILE_DS("request_time", 0.50)*1000 as "P50", APPROX_QUANTILE_DS("request_time", 0.90)*1000 as "P90" ,APPROX_QUANTILE_DS("request_time", 0.99)*1000 as 'P99',APPROX_QUANTILE_DS("request_time", 0.9999)*1000 as 'P9999' group by  _time_)
    • Host请求TOP图表所关联的查询分析语句如下所示:
      SELECT "host", pv, uv, round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "入流量(KB)" > 0 THEN "入流量(KB)" ELSE 0 END, 3 ) AS "入流量(KB)", round( CASE WHEN "出流量(KB)" > 0 THEN "出流量(KB)" ELSE 0 END, 3 ) AS "出流量(KB)"  FROM ( SELECT "host", count( 1 ) AS pv, APPROX_COUNT_DISTINCT ( my_remote_addr ) AS uv, sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", sum( request_length ) / 1024.0 AS "入流量(KB)", sum( bytes_sent ) / 1024.0 AS "出流量(KB)"  WHERE "host" != ''  GROUP BY "host" ) ORDER BY pv DESC
    • Host延迟TOP图表所关联的查询分析语句如下所示:
      SELECT "host", pv, round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)", round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)" FROM ( SELECT "host", count( 1 ) AS pv, sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)",APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != ''  GROUP BY "host" ) ORDER BY "平均延迟(ms)" desc
    • Host失败率TOP图表所关联的查询分析语句如下所示:
      SELECT "host", pv,round( CASE WHEN "访问失败率(%)" > 0 THEN "访问失败率(%)" ELSE 0 END, 2 ) AS "访问失败率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)", round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)"  FROM ( SELECT "host", count( 1 ) AS pv, sum( CASE WHEN "status" >= 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问失败率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != ''  GROUP BY "host"  ) ORDER BY "访问失败率(%)" desc
    • URL请求TOP图表所关联的查询分析语句如下所示:
      SELECT upstream_uri, pv,uv, round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "入流量(KB)" > 0 THEN "入流量(KB)" ELSE 0 END, 3 ) AS "入流量(KB)", round( CASE WHEN "出流量(KB)" > 0 THEN "出流量(KB)" ELSE 0 END, 3 ) AS "出流量(KB)"  FROM ( SELECT upstream_uri, count( 1 ) AS pv, APPROX_COUNT_DISTINCT ( my_remote_addr ) AS uv, sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", sum( request_length ) / 1024.0 AS "入流量(KB)", sum( bytes_sent ) / 1024.0 AS "出流量(KB)"  WHERE "host" != ''  GROUP BY upstream_uri  ) ORDER BY pv desc
    • URL失败率TOP图表所关联的查询分析语句如下所示:
      SELECT upstream_uri, pv, round( CASE WHEN "访问失败率(%)" > 0 THEN "访问失败率(%)" ELSE 0 END, 2 ) AS "访问失败率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)", round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)" FROM( SELECT upstream_uri, count( 1 ) AS pv, sum( CASE WHEN "status" >= 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问失败率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != '' GROUP BY upstream_uri  ) ORDER BY "访问失败率(%)" desc
    • 后端请求TOP图表所关联的查询分析语句如下所示:
      SELECT addr, pv, uv, round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "入流量(KB)" > 0 THEN "入流量(KB)" ELSE 0 END, 3 ) AS "入流量(KB)", round( CASE WHEN "出流量(KB)" > 0 THEN "出流量(KB)" ELSE 0 END, 3 ) AS "出流量(KB)"  FROM ( SELECT my_remote_addr as addr, count( 1 ) AS pv, APPROX_COUNT_DISTINCT ( my_remote_addr ) AS uv, sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", sum( request_length ) / 1024.0 AS "入流量(KB)", sum( bytes_sent ) / 1024.0 AS "出流量(KB)"  WHERE "host" != ''  GROUP BY addr  having length(my_remote_addr) > 2) ORDER BY "pv" desc
    • 后端延迟TOP图表所关联的查询分析语句如下所示:
      SELECT addr,pv,round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)",round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)",round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)",round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)" FROM (SELECT my_remote_addr as addr,count( 1 ) AS pv,sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)",avg( request_time ) * 1000 AS "平均延迟(ms)",APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)",APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != '' and "my_remote_addr" != '-' GROUP BY addr ) ORDER BY "平均延迟(ms)" desc
    • 后端失败率TOP图表所关联的查询分析语句如下所示:
      SELECT addr, pv, round( CASE WHEN "访问失败率(%)" > 0 THEN "访问失败率(%)" ELSE 0 END, 2 ) AS "访问失败率(%)", round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)", round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)", round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)"  FROM ( SELECT my_remote_addr as addr, count( 1 ) AS pv, sum( CASE WHEN "status" >= 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问失败率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != '' and "my_remote_addr" != '-' GROUP BY addr) ORDER BY "访问失败率(%)" desc
    • URL延迟TOP图表所关联的查询分析语句如下所示:
      SELECT upstream_uri, pv,round( CASE WHEN "访问成功率(%)" > 0 THEN "访问成功率(%)" ELSE 0 END, 2 ) AS "访问成功率(%)",round( CASE WHEN "平均延迟(ms)" > 0 THEN "平均延迟(ms)" ELSE 0 END, 3 ) AS "平均延迟(ms)",round( CASE WHEN "P90延迟(ms)" > 0 THEN "P90延迟(ms)" ELSE 0 END, 3 ) AS "P90延迟(ms)",round( CASE WHEN "P99延迟(ms)" > 0 THEN "P99延迟(ms)" ELSE 0 END, 3 ) AS "P99延迟(ms)" FROM (SELECT upstream_uri, count( 1 ) AS pv, sum( CASE WHEN "status" < 400 THEN 1 ELSE 0 END ) * 100.0 / count( 1 ) AS "访问成功率(%)", avg( request_time ) * 1000 AS "平均延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.9) * 1000 AS "P90延迟(ms)", APPROX_QUANTILE_DS(request_time, 0.99) * 1000 AS "P99延迟(ms)" WHERE "host" != ''  GROUP BY upstream_uri  ) ORDER BY "平均延迟(ms)" desc

查看APIG秒级监控

  1. 登录云日志服务控制台,在左侧导航栏中选择“仪表盘”。
  2. 在仪表盘模板下方,选择“APIG仪表盘模板 > APIG秒级监控”,查看图表详情。

    • 过滤请求域名,所关联的查询分析语句如下所示:
      select distinct(host)
    • 过滤app_id,所关联的查询分析语句如下所示:
      select distinct(app_id)
    • QPS图表所关联的查询分析语句如下所示:
      SELECT TIME_FORMAT(TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT1S'),'yyyy-MM-dd HH:mm:ss') AS _time_ , COUNT(*) as QPS from log group by _time_
    • 成功率图表所关联的查询分析语句如下所示:
      select __time,round(CASE WHEN "成功率" > 0 THEN "成功率" else 0 end,2) as "成功率" from (select TIME_FORMAT(TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT5S'),'yyyy-MM-dd HH:mm:ss') as __time, sum(case when status < 400 then 1 else 0 end) * 100.0 / count(1) as '成功率' from log group by __time)
    • 延迟图表所关联的查询分析语句如下所示:
      select __time,round(CASE WHEN "访问延迟" > 0 THEN "访问延迟" else 0 end,2) as "访问延迟",round(CASE WHEN "Upstream延迟" > 0 THEN "Upstream延迟" else 0 end,2) as "Upstream延迟" from (select TIME_FORMAT(TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT5S'),'yyyy-MM-dd HH:mm:ss') as __time, avg(request_time)* 1000 as '访问延迟',avg(upstream_response_time)* 1000 as 'Upstream延迟' from log group by __time)
    • 流量图表所关联的查询分析语句如下所示:
      select __time,round( CASE WHEN "请求流量" > 0 THEN "请求流量" ELSE 0 END, 3 ) AS "请求流量",round( CASE WHEN "返回body流量" > 0 THEN "返回body流量" ELSE 0 END, 3 ) AS "返回body流量" from (select TIME_FORMAT(TIME_CEIL(TIME_PARSE(time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ'),'PT5S'),'yyyy-MM-dd HH:mm:ss') as __time , sum("request_length") / 1024.0 as "请求流量", sum("body_bytes_sent") / 1024.0 as "返回body流量" group by __time)
    • 状态码图表所关联的查询分析语句如下所示:
      SELECT TIME_CEIL ( TIME_PARSE ( time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ' ), 'PT5S' ) AS "time", SUM( CASE WHEN "status" >= 200 AND "status" < 300 THEN 1 ELSE 0 END ) AS "2XX", SUM( CASE WHEN "status" >= 300 AND "status" < 400 THEN 1 ELSE 0 END ) AS "3XX", SUM( CASE WHEN "status" >= 400 AND "status" < 500 THEN 1 ELSE 0 END ) AS "4XX", SUM( CASE WHEN "status" >= 500 AND "status" < 600 THEN 1 ELSE 0 END ) AS "5XX", SUM( CASE WHEN "status" < 200 OR "status" >= 600 THEN 1 ELSE 0 END ) AS "其他" FROM log  WHERE TIME_PARSE ( time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ' ) IS NOT NULL GROUP BY "time"  ORDER BY "time" ASC LIMIT 100000
    • 后端响应码图表所关联的查询分析语句如下所示:
      SELECT TIME_CEIL ( TIME_PARSE ( time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ' ), 'PT5S' ) AS "time", SUM( CASE WHEN "upstream_status" >= 200 AND "upstream_status" < 300 THEN 1 ELSE 0 END ) AS "2XX", SUM( CASE WHEN "upstream_status" >= 300 AND "upstream_status" < 400 THEN 1 ELSE 0 END ) AS "3XX", SUM( CASE WHEN "upstream_status" >= 400 AND "upstream_status" < 500 THEN 1 ELSE 0 END ) AS "4XX", SUM( CASE WHEN "upstream_status" >= 500 AND "upstream_status" < 600 THEN 1 ELSE 0 END ) AS "5XX", SUM( CASE WHEN "upstream_status" < 200 OR "upstream_status" >= 600 THEN 1 ELSE 0 END ) AS "其他" FROM log  WHERE TIME_PARSE ( time_local, 'dd/MMM/yyyy:HH:mm:ss ZZ' ) IS NOT NULL GROUP BY "time"  ORDER BY "time" ASC LIMIT 100000