Help Center/ Cloud Firewall/ API Reference/ API/ Log Analysis/ Querying the Session Trend
Updated on 2025-08-12 GMT+08:00

Querying the Session Trend

Function

This API is used to query the session trend.

Calling Method

For details, see Calling APIs.

URI

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

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

ip

No

Array of strings

ips

vpc

No

Array of strings

vpcs

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

data

data object

Definition

Session trend statistics.

Range

N/A

Table 4 data

Parameter

Type

Description

records

Array of FlowTrendVO objects

Definition

Traffic trend data.

Range

N/A

total

Long

Definition

Total number.

Range

N/A

Table 5 FlowTrendVO

Parameter

Type

Description

agg_time

Long

Definition

Aggregation time point.

Range

N/A

in_bps

Double

Definition

Inbound bps.

Range

N/A

out_bps

Double

Definition

Outbound bps.

Range

N/A

Status code: 400

Table 6 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 session trend. The project ID is a16df7cf1d094befa6bbc72cbf51e93a, the firewall ID is c598d612-8112-465c-bffd-863d4ce85a50, the time range is the last hour, and the VPC ID is 42562e8a-af8d-4a9a-91a4-c1d6c83ecfc5.

https://{Endpoint}/v1/a16df7cf1d094befa6bbc72cbf51e93a/cfw/logs/flow-trend?fw_instance_id=c598d612-8112-465c-bffd-863d4ce85a50&range=0&vpc=42562e8a-af8d-4a9a-91a4-c1d6c83ecfc5&log_type=vpc

Example Responses

Status code: 200

OK

{
  "data" : {
    "records" : [ {
      "agg_time" : 1751522040000,
      "in_bps" : 0,
      "out_bps" : 0
    } ],
    "total" : 60
  }
}

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.