Help Center/ Cloud Firewall/ API Reference/ API/ Log Analysis/ Querying Top Traffic Statistics
Updated on 2025-08-12 GMT+08:00

Querying Top Traffic Statistics

Function

This API is used to query top traffic statistics.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/cfw/logs/flow-top

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

fw_instance_id

Yes

String

Definition

Firewall ID. It is a unique ID generated after a firewall instance is created. You can obtain the firewall ID by referring to Obtaining a Firewall ID.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

range

No

Integer

Definition

Time range.

Constraints

N/A

Range

0 (last hour), 1 (last day), or 2 (last seven days)

Default Value

N/A

log_type

Yes

String

Definition

Log type.

Constraints

N/A

Range

internet (north-south logs), nat (NAT logs), vpc (east-west logs), or vgw (VGW logs)

Default Value

N/A

direction

No

String

Definition

Session direction.

Constraints

N/A

Range

in2out (outbound) or out2in (inbound)

Default Value

N/A

start_time

No

Long

Definition

Start time.

Constraints

N/A

Range

Milliseconds-level timestamp.

Default Value

N/A

end_time

No

Long

Definition

End time.

Constraints

N/A

Range

Milliseconds-level timestamp.

Default Value

N/A

vgw_id

No

Array of strings

Definition

VGW ID

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

asset_type

No

String

Definition

IP type.

Constraints

N/A

Range

public: EIP

private: private IP address

open_port

Default Value

N/A

item

Yes

Array of strings

Definition

Aggregation type.

Constraints

N/A

Range

src_ip: source IP address

dst_ip: destination IP address

dst_port: destination port

protocol: protocol

dst_host: destination domain name

app: application

dst_region_name: destination region

src_region_name: source region

Default Value

N/A

order

Yes

String

Definition

Sorting criteria.

Constraints

N/A

Range

record: number of sessions

byte: session traffic

Default Value

5

size

No

Integer

Definition

Number of aggregated records.

Constraints

N/A

Range

0 to 10

Default Value

5

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

data

Map<String,Array<ItemVO>>

Definition

Top statistics.

Range

N/A

Table 4 ItemVO

Parameter

Type

Description

key

String

Definition

Aggregation item.

Range

N/A

name

String

Definition

Aggregation item name.

Range

N/A

value

Long

Definition

Statistical value.

Range

N/A

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Example Requests

Query the top accessed domain names and sort them by session traffic. The project ID is a16df7cf1d094befa6bbc72cbf51e93a, the firewall ID is c598d612-8112-465c-bffd-863d4ce85a50, the time range is seven days, and the direction is outbound.

 https://{Endpoint}/v1/a16df7cf1d094befa6bbc72cbf51e93a/cfw/logs/flow-top?fw_instance_id=c598d612-8112-465c-bffd-863d4ce85a50&log_type=internet&order=byte&item=dst_host&range=2&direction=in2out

Example Responses

Status code: 200

OK

{
  "data" : {
    "dst_host" : [ {
      "key" : "www.test.com",
      "value" : 10219
    } ]
  }
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00200007",
  "error_msg" : "Incorrect time range."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.