跳转至

查询日志

1. 接口描述

接口请求路径:POST /prod-api/waf/nlaV1/log/describeLog

describeLog 用于在指定时间范围内分页查询 HTTP DDoS(NLA)访问与安全日志明细。请求体通过 action 声明指标(本接口常用 logs)与分页;params 传入起止时间;otherFilter 为筛选条件列表,无筛选时传 []

说明:本接口 metricNamelogs 返回日志列表;攻击趋势时序请使用「查询攻击数据」接口的 logTread。Token 获取方式见 密钥鉴权

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
action Array 指标与分页配置列表;本接口通常仅一项
action.metricName String 统计指标,支持以下值:
logs:访问与安全日志明细列表
logTread:日志量时间序列(本接口内附带趋势聚合,粒度按时间跨度自动选择)
示例值:logs
action.pageNo Integer 页码,从 1 开始。logs 必填
示例值:1
action.pageSize Integer 每页条数。logs 必填
示例值:15
domains Array of String 域名过滤。空数组或不传表示当前账号全部域名
示例值:[]
otherFilter Array 附属筛选条件;无筛选时传 []
otherFilter.oneVal String 筛选字段,支持以下值:
oid:套餐
client_ip:来源 IP
domain:域名
url:URL
status:状态码
request_method:请求方法
server_port:端口
ua_os_name:操作系统
ua_name:浏览器
client_country_name:国家/地区
client_city_name:城市
acl_id:策略组
rule_Id:规则 ID
action:处置动作
bot_score:Bot 评分
request_id:请求 ID
hostname:主机名
timezone:时区
http_user_agent:User-Agent
示例值:oid
otherFilter.twoVal String 比较方式,支持以下值:
eq:等于
ne:不等于
contain:包含(通配)
gt:大于
lt:小于
gte:大于等于
lte:小于等于
示例值:eq
otherFilter.threeVal Array of String 比较值列表。contain 与范围比较取首个值
示例值:["22"]
params.beginTime String 开始时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2026-05-12 17:37:33
params.endTime String 结束时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2026-05-15 17:37:33

3. 示例

示例1 分页查询日志明细

输入示例

{
  "action": [
    {
      "metricName": "logs",
      "pageNo": 1,
      "pageSize": 15
    }
  ],
  "otherFilter": [],
  "params": {
    "beginTime": "2026-05-12 17:37:33",
    "endTime": "2026-05-15 17:37:33"
  }
}

代码调用

请将 {登录域名}token 替换为实际值。

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class DescribeLogTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/waf/nlaV1/log/describeLog";
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        String requestBody = "{"
                + "\"action\":[{\"metricName\":\"logs\",\"pageNo\":1,\"pageSize\":15}],"
                + "\"otherFilter\":[],"
                + "\"params\":{"
                + "\"beginTime\":\"2026-05-12 17:37:33\","
                + "\"endTime\":\"2026-05-15 17:37:33\""
                + "}"
                + "}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Authorization", "Bearer " + token);
            httpPost.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));

            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
                int statusCode = response.getStatusLine().getStatusCode();
                String body = EntityUtils.toString(response.getEntity(), "UTF-8");
                System.out.println("Status Code: " + statusCode);
                System.out.println("Body: " + body);
            }
        }
    }
}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://{登录域名}/prod-api/waf/nlaV1/log/describeLog"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "action": [
    {"metricName": "logs", "pageNo": 1, "pageSize": 15}
  ],
  "otherFilter": [],
  "params": {
    "beginTime": "2026-05-12 17:37:33",
    "endTime": "2026-05-15 17:37:33"
  }
}`)

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+token)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println("Status Code:", resp.StatusCode)
    fmt.Println("Body:", string(body))
}

输出示例

{
  "msg": "成功",
  "code": 200,
  "data": [
    {
      "metricName": "logs",
      "list": [
        {
          "requestId": "9a8dd5baa3e3e80ef69a1ea7c03265a8",
          "aclId": "74",
          "clientIp": "20.197.195.237",
          "ua": null,
          "geoip": {
            "country": "United States",
            "regionName": null,
            "latitude": 37.751,
            "longitude": -97.822,
            "countryCode": "US"
          },
          "rules": [
            {
              "ruleId": "122",
              "ruleMessage": "人机",
              "matches": [
                {
                  "parameter": "/insta.php",
                  "operator": "BEGINS_WITH",
                  "target": "REQUEST_URI"
                }
              ]
            }
          ],
          "scheme": "http",
          "requestMethod": "GET",
          "httpUserAgent": "",
          "protocol": "HTTP/1.1",
          "url": "/insta.php",
          "domain": "lwtest.ruisuyun.com",
          "serverPort": "80",
          "referer": "",
          "action": "captcha",
          "status": 200,
          "botScore": null,
          "ja4": null,
          "asn": null,
          "asnOrg": null,
          "timestamp": "2026-05-14 14:21:33"
        }
      ]
    }
  ]
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
data Array 指标结果列表,顺序与请求 action 一致
data[].metricName String 指标名称。示例值:logs
data[].list Array of [NlaLogItem] logs 时为日志记录列表
data[].objectArrayList Array logTread 时为时序点列表,每项为 [毫秒时间戳, 数值]
data[].count Integer logTread 时的合计计数

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
附属查询条件的条件类型有误 otherFilter.twoVal 不是支持的比较方式
分数查询条件不能为空 范围比较时 threeVal 为空
查询日志失败 查询执行失败或参数非法

6. 数据模型

NlaLogItem

单条访问/安全日志记录。

参数名称 类型 描述
requestId String 请求唯一标识。示例值:9a8dd5baa3e3e80ef69a1ea7c03265a8
aclId String 命中的策略组 ID。示例值:74
clientIp String 客户端来源 IP。示例值:20.197.195.237
ua Object 解析后的 UA 结构;无解析结果时可能为 null
geoip [NlaGeoip] 地理位置解析结果
rules Array of [NlaHitRule] 命中的规则列表
scheme String 请求协议,如 httphttps
requestMethod String HTTP 方法,如 GETPOST
httpUserAgent String 原始 User-Agent;可能为空字符串
protocol String 协议版本,如 HTTP/1.1
url String 请求路径
domain String 访问域名
serverPort String 站点端口。示例值:80
referer String Referer 请求头
action String 处置动作。示例值:captcha
status Integer HTTP 响应状态码。示例值:200
botScore Integer Bot 评分;可能为 null
ja4 String JA4 指纹;可能为 null
asn String ASN 编号;可能为 null
asnOrg String ASN 组织名;可能为 null
timestamp String 事件时间,格式 yyyy-MM-dd HH:mm:ss

NlaGeoip

地理位置信息。

参数名称 类型 描述
country String 国家或地区名称。示例值:United States
regionName String 省州等区域名;无则可能为 null
latitude Number 纬度。示例值:37.751
longitude Number 经度。示例值:-97.822
countryCode String ISO 国家/地区二位码。示例值:US

NlaHitRule

命中规则信息。

参数名称 类型 描述
ruleId String 规则 ID。示例值:122
ruleMessage String 规则名称或说明。示例值:人机
matches Array of [NlaRuleMatch] 匹配条件列表

NlaRuleMatch

规则匹配项。

参数名称 类型 描述
parameter String 参与匹配的具体值或模式片段。示例值:/insta.php
operator String 匹配算子。示例值:BEGINS_WITH
target String 匹配作用目标。示例值:REQUEST_URI