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

Querying the Number of Logs

Function

Collect statistics on the number of logs, for example, the number of unsafe IP addresses.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/logs/count

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

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

item

Yes

String

Definition

Aggregation type.

Constraints

N/A

Range

risk_ip: number of accessed unsafe IP addresses

risk_host: number of accessed unsafe domain names

open_port: number of open ports

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

data

data object

Definition

Aggregation time point.

Range

N/A

Table 4 data

Parameter

Type

Description

count

Long

Definition

Aggregation time point.

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 number of unsafe IP addresses whose project ID is a16df7cf1d094befa6bbc72cbf51e93a, firewall ID is dc3f5b8e-efed-4e31-9ed0-785f342c51fc, and time range is 1751450695602 to 17514542956027.

https://{Endpoint}/v1/a16df7cf1d094befa6bbc72cbf51e93a/logs/count?fw_instance_id=dc3f5b8e-efed-4e31-9ed0-785f342c51fc&item=risk_ip&start_time=1751450695602&end_time=1751454295602

Example Responses

Status code: 200

ShowLogsCountResp

{
  "data" : {
    "count" : 0
  }
}

Status code: 400

Bad Request

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

Status Codes

Status Code

Description

200

ShowLogsCountResp

400

Bad Request

Error Codes

See Error Codes.