更新时间:2024-06-14 GMT+08:00
分享

APIG访问中心

APIG访问中心仪表盘主要展示APIG日志的PV对比、访问量PV分布(中国)、访问量PV分布(世界)、访问量UV分布(中国)、访问量UV分布(世界)、平均时延分布(中国)、平均时延分布(世界)、今日PV/UV、7日PV/UV、区域访问TOP10(省份)、区域访问TOP10(城市)、Host访问TOP10、UserAgent访问TOP10、设备占比(终端)、设备占比(系统)、TOP URL、TOP 访问IP等信息,全方位展示网站访问情况。您还可以使用云日志服务的查询分析语句,分析网站的延时情况,及时调优网站。

前提条件

背景信息

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

分析APIG监控情况

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

APIG访问中心仪表盘中的过滤器说明如下所示:

  • 获取所有请求域名,所关联的查询分析语句如下所示:
    select distinct(host)
  • 获取所有app_id,所关联的查询分析语句如下所示:
    select distinct(app_id)

重要图表说明

  • PV对比昨日图展示PV数对比昨日的变化情况,所关联的查询分析语句如下所示:
    select diff[1] as "total", round((diff[1] - diff[2]) / diff[2] * 100, 2) as inc from(select compare( "pv" , 86400) as diff from (select count(1) as "pv" from log))
  • PV对比上周图展示PV数对比上周的变化情况,所关联的查询分析语句如下所示
    select diff[1] as "total", round((diff[1] - diff[2]) / diff[2] * 100, 2) as inc from(select compare( "pv" , 604800) as diff from (select count(1) as "pv" from log))
  • UV对比昨日图展示UV数对比昨日的变化情况,所关联的查询分析语句如下所示:
    select diff[1] as "total", round((diff[1] - diff[2]) / diff[2] * 100, 2) as inc from(select compare( "uv" , 86400) as diff from (select APPROX_COUNT_DISTINCT(my_remote_addr) as "uv" from log))
  • UV对比上周图展示UV数对比上周的变化情况,所关联的查询分析语句如下所示:
    select diff[1] as "total", round((diff[1] - diff[2]) / diff[2] * 100, 2) as inc from(select compare( "uv" , 604800) as diff from (select APPROX_COUNT_DISTINCT(my_remote_addr) as "uv" from log))
  • 访问量PV分布(中国)图展示中国区域内访问量PV的分布情况,所关联的查询分析语句如下所示:
    select ip_to_province(my_remote_addr) as province, 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)  where IP_TO_COUNTRY (my_remote_addr) = '中国'  group by province HAVING province not in ('','保留地址','*')
  • 访问量PV分布(世界)图展示世界区域内访问量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图展示最近一天的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图展示访问排名前十的UserAgent,所关联的查询分析语句如下所示:
    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图展示访问前十url的PV、UV及访问成功率等信息,所关联的查询分析语句如下所示:
    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图展示访问前十的IP及城市、运营商和PV等数据,所关联的查询分析语句如下所示:
    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
分享:

    相关文档

    相关产品