Updated on 2025-08-12 GMT+08:00

Exporting Firewall Logs

Function

This API is used to export firewall logs.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/cfw/{fw_instance_id}/logs/export

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

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

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

filters

No

Array of Filter objects

Definition

Filter criteria.

Constraints

N/A

Range

1-1024

Default Value

N/A

start_time

Yes

Long

Definition

Start time.

Constraints

N/A

Range

Milliseconds-level timestamp.

Default Value

N/A

end_time

Yes

Long

Definition

End time.

Constraints

N/A

Range

Milliseconds-level timestamp.

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

type

Yes

String

Definition

Log type.

Constraints

N/A

Range

attack (attack logs), acl (access control logs), flow (traffic logs), or url (URL logs)

Default Value

N/A

time_zone

No

String

Definition

Time zone.

Constraints

N/A

Range

"GMT+08:00"

Default Value

N/A

Table 3 Filter

Parameter

Mandatory

Type

Description

field

Yes

String

Definition

Log field, for example, src_ip.

Constraints

N/A

Range

N/A

Default Value

N/A

values

No

Array of strings

Definition

Value.

Constraints

N/A

Range

N/A

Default Value

N/A

operator

Yes

String

Definition

Operator.

Constraints

N/A

Range

equal

not_equal

contain

starts_with

Default Value

N/A

Response Parameters

Status code: 200

OK

Status code: 400

Table 4 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

The project ID is a16df7cf1d094befa6bbc72cbf51e93a, the firewall ID is fcd04edd-428a-4631-bef5-46a924293cca, and the time range is from 1751958412875 to 1751969212875. Set the destination IP address to 100.85.219.117 and destination port to 55637. Export Internet border traffic logs.

https://{Endpoint}/v1/a16df7cf1d094befa6bbc72cbf51e93a/cfw/fcd04edd-428a-4631-bef5-46a924293cca/logs/export

{
  "filters" : [ {
    "field" : "dst_ip",
    "operator" : "equal",
    "values" : [ "100.85.219.117" ]
  }, {
    "field" : "src_port",
    "operator" : "equal",
    "values" : [ "55637" ]
  } ],
  "start_time" : 1751958412875,
  "end_time" : 1751969212875,
  "type" : "flow",
  "log_type" : "internet",
  "time_zone" : "GMT%2B08:00"
}

Example Responses

Status code: 400

Bad Request

{
  "error_code" : "CFW.00200003",
  "error_msg" : "Parameter error."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.