CDN

  • CDN > API 文档 > 运营统计

    运营统计

    最近更新时间: 2026-03-25 14:06:40

    1. 快速查阅区

    1.1 核心接口概览

    接口功能 请求方法 接口路径 特殊参数 成功响应
    缓存命中率统计 POST /v2/tune/loganalyze/hitmiss freq {"code":200,"data":{...}}
    HTTP 状态码统计 POST /v2/tune/loganalyze/statuscode freq、region、isp {"code":200,"data":{...}}
    请求次数统计 POST /v2/tune/loganalyze/reqcount freq、region {"code":200,"data":{...}}
    UV 独立访客统计 POST /v2/tune/loganalyze/uniquevisitor freq {"code":200,"data":{...}}
    访问次数Top URL统计 POST /v2/tune/loganalyze/topcounturl region {"code":200,"data":{...}}
    访问流量Top URL统计 POST /v2/tune/loganalyze/toptrafficurl region {"code":200,"data":{...}}
    访问次数Top IP统计 POST /v2/tune/loganalyze/topcountip region {"code":200,"data":{...}}
    访问流量Top IP统计 POST /v2/tune/loganalyze/toptrafficip region {"code":200,"data":{...}}
    区域运营商流量统计 POST /v2/tune/loganalyze/traffic freq、region、isp {"code":200,"data":{...}}
    区域运营商带宽统计 POST /v2/tune/loganalyze/bandwidth freq、region、isp {"code":200,"data":{...}}
    ISP 请求次数统计 POST /v2/tune/loganalyze/ispreqcount freq、region {"code":200,"data":{...}}
    ISP 流量占比统计 POST /v2/tune/loganalyze/isptraffic freq {"code":200,"data":{...}}

    1.2 核心约束

    • 请求域名: fusion.qiniuapi.com
    • 鉴权方式: QBox 鉴权(详见 鉴权指南
    • QPS限制: 5-10 QPS
    • 数据保留: 90 天
    • 时间跨度: ≤ 30 天,超出返回 400331

    1.3 参数关键差异

    • domains 为 array 类型 (如 ["a.com","b.com"]),不是字符串。
    • 用量统计的 domains 为 string 类型 (分号分隔) 不同,务必区分。
    • freq 值格式: "5min" / "1hour" / "1day",注意带数字前缀,传 "day""hour" 会返回 400331。

    2. 公共请求参数

    参数名 类型 必填 说明 示例值
    domains array 域名数组,最多 100 个 ["a.com","b.com"]
    startDate string 开始日期,格式 yyyy-MM-dd "2026-02-01"
    endDate string 结束日期,格式 yyyy-MM-dd,跨度 ≤ 30 天 "2026-02-10"
    freq string 部分接口必传 时间粒度 "5min" / "1hour" / "1day"
    region string 部分接口可选 区域 "global" / "china" / "oversea"

    Top 类接口 (topcounturl/toptrafficurl/topcountip/toptrafficip) 不传 freq;traffic/bandwidth 接口额外需要 isp 参数。
    部分参数必传差异参考:5.2 接口参数分组;region 可选区域参考:5.3 附件: Region 参数列表

    3. 公共响应格式

    公共响应参数

    参数名 类型 说明
    code int 响应状态码
    error string 响应错误描述
    data map 响应数据

    公共响应示例

    示例:

    {
        "code": 200,
        "error": "",
        "data": {
            ...
        }
    }
    

    4. 详细接口说明

    4.1 缓存命中率统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/hitmiss
    • 数据说明: 返回 hit/miss 请求次数和流量命中数据

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/hitmiss' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-01","endDate":"2026-02-01","freq":"1day"}'
    

    响应内容

    {
       "data" : {
          "points" : [<point1>, <point2>, <point3>, ......],
          "hit" : [<hitCount1>, <hitCount2>, <hitCount3>, ......],
          "miss" : [<missCount1>, <missCount2>, <missCount3>, ......],
          "trafficHit" : [<trafficHitCount1>, <trafficHitCount2>, <trafficHitCount3>, ......],
          "trafficMiss" : [<trafficMissCount1>, <trafficMissCount2>, <trafficMissCount3>, ......]
       },
       "error" : <error>,
       "code" : <code>
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    hitCountN long pointN 时间点的命中次数
    missCountN long pointN 时间点的未命中次数
    trafficHitCountN long pointN 时间点的命中流量,单位 Byte
    trafficMissCountN long pointN 时间点的未命中流量,单位 Byte

    4.2 HTTP 状态码统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/statuscode
    • 数据说明: 各 HTTP 状态码 (2xx/3xx/4xx/5xx) 的请求次数

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/statuscode' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day","region":"global"}'
    

    isp 可选值: "telecom" (电信) / "unicom" (联通) / "mobile" (移动) / "drpeng" (鹏博士) / "tietong" (铁通) / "cernet" (教育网) /"all" (所有 ISP)

    响应内容

    {
       "data" : {
          "codes" : {
             <statusCode> : [<codeCount1>, <codeCount2>, <codeCount3>, ......]
          },
          "points" : [<point1>, <point2>, <point3>, ......]
       },
       "error" : <error>,
       "code" : <code>
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    statusCode string 状态码
    codeCountN long 状态码在 pointN 时间点的个数

    4.3 请求次数统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/reqcount
    • 数据说明: 按区域查询 CDN 总请求次数

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/reqcount' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day","region":"global"}'
    

    响应内容

    {
       "data" : {
          "reqCount" : [<reqCount1>, <reqCount2>, <reqCount3>, ......],
          "points" : [<point1>, <point2>, <point3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    reqCountN long pointN 时间点的请求次数

    4.4 UV 独立访客统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/uniquevisitor
    • 数据说明: 每日独立访客数 (UV)

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/uniquevisitor' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day"}'
    

    响应内容

    {
       "data" : {
          "uvCount" : [<uvCount1>, <uvCount2>, <uvCount3>, ......],
          "points" : [<point1>, <point2>, <point3>, ......]
       },
       "error" : <error>,
       "code" : <code>
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    uvCountN long pointN 时间点的 UniqueVisitor 个数

    4.5 访问次数Top URL统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/topcounturl
    • 数据说明: 按访问次数排序的 URL 列表,默认 Top 100

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/topcounturl' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","region":"global"}'
    

    响应内容

    {
       "data" : {
          "count" : [<count1>, <count2>, <count3>, ......],
          "urls": [<url1>, <url2>, <url3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    urlN string URL,去查询参数
    countN long urlN 在查询时间区间内的访问次数,降序排列

    4.6 访问流量Top URL统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/toptrafficurl
    • 数据说明: 按访问流量排序的 URL 列表

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/toptrafficurl' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","region":"global"}'
    

    响应内容

    {
       "data" : {
          "traffic" : [<traffic1>, <traffic2>, <traffic3>, ......],
          "urls": [<url1>, <url2>, <url3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    urlN string URL,去查询参数
    trafficN long urlN 在查询时间区间内的访问流量,单位 Byte。降序排列

    4.7 访问次数Top IP统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/topcountip
    • 数据说明: 按访问次数排序的客户端 IP 列表

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/topcountip' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","region":"global"}'
    

    响应内容

    {
       "data" : {
          "count" : [<count1>, <count2>, <count3>, ......],
          "ips": [<ip1>, <ip2>, <ip3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    ipN string IP
    countN long ipN 在查询时间区间内的访问次数,降序排列

    4.8 访问流量Top IP统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/toptrafficip
    • 数据说明: 按访问流量排序的客户端 IP 列表

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/toptrafficip' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","region":"global"}'
    

    响应内容

    {
       "data" : {
          "traffic" : [<traffic1>, <traffic2>, <traffic3>, ......],
          "ips": [<ip1>, <ip2>, <ip3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    ipN string IP
    trafficN long ipN 在查询时间区间内的访问流量,单位 Byte。降序排列

    4.9 区域运营商流量统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/traffic
    • 数据说明: 按区域/运营商查询流量数据
    • 额外必传: isp 参数

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/traffic' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day","region":"china","isp":"telecom"}'
    

    isp 可选值: "telecom" (电信) / "unicom" (联通) / "mobile" (移动) / "drpeng" (鹏博士) / "tietong" (铁通) / "cernet" (教育网) /"all" (所有 ISP)

    响应内容

    {
      "code": <code>,
      "error": <error>,
      "data": {
         "points": [<point1>, <point2>, <point3>, ......],
         "value": [<value1>, <value2>, <value3>, ......]
      }
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    valueN long 在 pointN 时间点的流量

    4.10 区域运营商带宽统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/bandwidth
    • 数据说明: 按区域/运营商查询带宽数据
    • 额外必传: isp 参数 (同 traffic 接口)

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/bandwidth' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day","region":"china","isp":"telecom"}'
    

    isp 可选值: "telecom" (电信) / "unicom" (联通) / "mobile" (移动) / "drpeng" (鹏博士) / "tietong" (铁通) / "cernet" (教育网) /"all" (所有 ISP)

    响应内容

    {
      "code": <code>,
      "error": <error>,
      "data": {
         "points": [<point1>, <point2>, <point3>, ......],
         "value": [<value1>, <value2>, <value3>, ......]
      },
      "stats": {
        "peak": {
          "time": <peakTime>,
          "value": <peakValue>
        },
        "peak95": {
          "time": <peak95Time>,
          "value": <peak95Value>
        },
        "peak95Average": <peak95Average>,
        "peakAverage": <peakAverage>
      }
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    valueN long 在 pointN 时间点的带宽
    peakTime string 峰值的时间点,形如 2026-01-02-15-04
    peakValue long 峰值带宽
    peak95Time string 95峰的时间点,形如 2026-01-02-15-04
    peak95Value long 95峰带宽
    peakAverage long 各天峰值的平均值
    peak95Average long 各天95峰的平均值

    4.11 ISP 请求次数统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/ispreqcount
    • 数据说明: 按运营商查询 CDN 请求次数

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/ispreqcount' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day","region":"global"}'
    

    响应内容

    {
       "data" : {
          "ispReq" : {
              <isp>: [<reqCount1>, <reqCount2>, <reqCount3>, ......]
          },
          "points" : [<point1>, <point2>, <point3>, ......]
       },
       "error" : <error>,
       "code": <code>
    }
    

    响应参数

    参数名 类型 说明
    pointN string 时间点,形如 2026-01-02-15-04
    isp string ISP 运营商,包括 telecom(电信)、unicom(联通)、 mobile(移动)、drpeng(鹏博士)、tietong(铁通)、cernet(教育网)、others(其他)
    reqCountN long pointN 时间点的请求次数

    4.12 ISP 流量占比统计

    基本信息

    • 接口地址: https://fusion.qiniuapi.com/v2/tune/loganalyze/isptraffic
    • 数据说明: 各运营商的流量占比

    请求示例

    curl -X POST 'https://fusion.qiniuapi.com/v2/tune/loganalyze/isptraffic' \
      -H 'Host: fusion.qiniuapi.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: QBox <AK>:<Sign>' \
      -d '{"domains":["test.example.com"],"startDate":"2026-02-10","endDate":"2026-02-13","freq":"1day"}'
    

    响应内容

    {
      "code": <code>,
      "error" : <error>,
      "data": {
         "isp1": <value1>,
         "isp2": <value2>
      }
    }
    

    响应参数

    参数名 类型 说明
    ispN string 运营商
    valueN float 运营商 ispN 对应的流量占总流量的比例

    5. 常见问题

    5.1 专属错误码

    错误码 描述 场景 解决方案
    400 domains 类型错误 传了字符串而非数组 domains 必须为 array
    400331 非法参数 freq 值错误 (传 “day” 而非 “1day”)、时间跨度超 30 天、缺少必传参数 检查 freq 格式和时间范围
    400080 开始时间格式错误 startDate 非 yyyy-MM-dd 修正日期格式
    400081 结束时间格式错误 endDate 非 yyyy-MM-dd 修正日期格式
    400032 无效域名 域名未接入 CDN 确认域名已创建且上线

    5.2 接口参数分组

    接口 freq region isp
    hitmiss 必传 - -
    statuscode 必传 可选 可选
    reqcount 必传 可选 -
    uniquevisitor 必传 - -
    topcounturl - 可选 -
    toptrafficurl - 可选 -
    topcountip - 可选 -
    toptrafficip - 可选 -
    traffic 必传 必传 必传
    bandwidth 必传 必传 必传
    ispreqcount 必传 必传 -
    isptraffic 必传 - -

    5.3 附件: Region 参数列表

    参数 说明
    global 全球
    oversea 海外
    china 中国
    shandong 山东
    jiangsu 江苏
    zhejiang 浙江
    anhui 安徽
    shanghai 上海
    fujian 福建
    jiangxi 江西
    guangdong 广东
    guangxi 广西
    hainan 海南
    henan 河南
    hunan 湖南
    hubei 湖北
    beijing 北京
    tianjin 天津
    hebei 河北
    shanxi 山西
    neimenggu 内蒙古
    ningxia 宁夏
    qinghai 青海
    gansu 甘肃
    shaanxi 陕西
    sichuan 四川
    guizhou 贵州
    xinjiang 新疆
    yunnan 云南
    chongqing 重庆
    xizang 西藏
    liaoning 辽宁
    jilin 吉林
    heilongjiang 黑龙江
    hongkong 香港
    macau 澳门
    taiwan 台湾
    unknown 未知地区

    5.4 最佳实践

    • domains 格式: 数组类型,与用量统计的字符串类型不同
    • freq 格式: 必须带数字前缀 "5min" / "1hour" / "1day",传 "day" 会 400331
    • 时间范围: 跨度 ≤ 30 天,超出返回 400331
    • traffic/bandwidth/statuscode: 需额外传 region + isp 参数
    • Top 类接口: 不传 freq,默认返回 Top 100

    参考: 鉴权详见 鉴权指南,错误码详见 公共错误码&通用约束

    以上内容是否对您有帮助?