tencent cloud

APIs

DescribeCfwLogs

Download
聚焦模式
字号
最后更新时间: 2026-08-03 21:02:49

1. API Description

Domain name for API request: cfw.intl.tencentcloudapi.com.

This API is used to query the firewall log of the current tenant. Only use HasMore/NextToken in Response.Data to paginate.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeCfwLogs.
Version Yes String Common Params. The value used for this API: 2019-09-04.
Region No String Common Params. This parameter is not required for this API.
LogType No String Log type. Required for the initial query; cannot be passed when using NextToken for continuation. cfw_netflow_border=Internet boundary traffic, cfw_netflow_vpc=VPC east-west traffic, cfw_netflow_nat=NAT firewall traffic, cfw_netflow_nta=NDR/NTA traffic, cfw_netflow_dns=DNS firewall log, cfw_rule_threatinfo=Intrusion defense/Threat Intelligence Alarm, cfw_rule_acl=Internet Boundary Access Control log, cfw_rule_vpc_acl=VPC access control log, cfw_rule_nat_acl=NAT access control log, cfw_ndr_subject_risk=NDR topic risk, cfw_ndr_dataleak_entry=NDR sensitive data leak, cfw_ndr_ai_audit=NDR AI application identification and Large Model Invocation audit, cfw_feature_collect=Statistical feature and baseline anomaly, cfw_behavior_collect=Beacon/DNS/port/cert/VPC mutual access behavior, operate_log_all=Operation audit log.
Query No String Log filter expression. Default * means no filtering; for example src_ip:1.1.1.1. Queryable fields vary with LogType. You should preferentially use the field name returned in the corresponding Items. Do not guess non-existing fields. It cannot be passed when using NextToken for continued query.
StartTime No String Query start time. Supports RFC3339, YYYY-MM-DD HH:MM:SS, YYYY-MM-DD, or Unix timestamp. Input to query the TimeRange backward from this time. Cannot be imported when using NextToken for continued querying.
TimeRange No String Query time range. Default 1h; format is positive integer plus unit m/h/d, such as 5m, 1h, 24h, 7d; cannot be passed when using NextToken for continuation.
Limit No Integer Return limit. Selectable for initial query, default 100; value 1 to 1000; cannot be passed when using NextToken for continued query.
NextToken No String Previous page opaque continuation token returned by Response.Data. Not required for initial query; only required for continuation query with NextToken. Invalid, tampered, or mismatched tenant will be rejected.

3. Output Parameters

Parameter Name Type Description
Data String Query result. UTF-8 JSON object string; the caller must parse Response.Data. Items is the log array of the current page, and fields vary with LogType. TotalCount is the return limit of the current page, Limit is the page size, and LogType and TimeWindow echo the query scope. When HasMore=true, NextToken must be saved and used as-is for continued querying. When HasMore=false, pagination ends.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Initial query firewall log

Initial query imports LogType. If Data.HasMore is true, save Data.NextToken for subsequent queries.

Input Example

POST / HTTP/1.1
Host: cfw.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCfwLogs
<Common request parameters>

{
    "LogType": "cfw_netflow_border",
    "Query": "src_ip:1.1.1.1",
    "TimeRange": "1h",
    "Limit": 100
}

Output Example

{
    "Response": {
        "Data": "{\"Items\":[{\"src_ip\":\"1.1.1.1\"}],\"TotalCount\":1,\"Limit\":100,\"HasMore\":true,\"NextToken\":\"opaque-token\"}",
        "RequestId": "4266525E-10C4-41E1-8A28-5CCE1FBF6A58"
    }
}

Example2 Using NextToken to continue the query

The continuation query only returns NextToken; the caller does not parse or construct a token.

Input Example

POST / HTTP/1.1
Host: cfw.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeCfwLogs
<Common request parameters>

{
    "NextToken": "opaque-token"
}

Output Example

{
    "Response": {
        "Data": "{\"Items\":[],\"TotalCount\":0,\"Limit\":100,\"HasMore\":false}",
        "RequestId": "4266525E-10C4-41E1-8A28-5CCE1FBF6A58"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.ResponseTooLarge FailedOperation.ResponseTooLarge
InternalError Internal error.
InvalidParameter Invalid parameter.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈