Updated on 2024-04-25 GMT+08:00

Configuring LTS for WAF Logging

Function

This API is used to enable or disable Log Tank Service (LTS) for WAF logging and to configure log groups and streams. You can obtain the log group ID and log stream ID from LTS. The log stream ID must belong to the log group you configure.

URI

PUT /v1/{project_id}/waf/config/lts/{ltsconfig_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. To obtain it, go to Cloud management console and hover the cursor over your username. On the displayed window, choose My Credentials.Then, in the Projects area, view Project ID of the corresponding project.

ltsconfig_id

Yes

String

ID of the LTS configuration. The ID can be obtained by calling the ShowLtsInfoConfig API.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

You can obtain the ID by calling the ListEnterpriseProject API of EPS.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Content-Type

Yes

String

Content type.

Default: application/json;charset=utf8

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

enabled

No

Boolean

Whether to enable LTS for WAF logging\n - false: LTS is disabled for WAF.\n - true: LTS is enabled for WAF.

ltsIdInfo

No

LtsIdInfo object

Log group and log stream IDs.

Table 5 LtsIdInfo

Parameter

Mandatory

Type

Description

ltsGroupId

No

String

Log group ID.

ltsAccessStreamID

No

String

Log stream ID for access logs

ltsAttackStreamID

No

String

Log stream ID for attack logs

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

id

String

LTS configuration information ID. Each enterprise project has a unique ID.

enabled

Boolean

Whether to enable LTS for WAF logging\n - false: LTS is disabled for WAF.\n - true: LTS is enabled for WAF.

ltsIdInfo

LtsIdInfo object

Log group and log stream IDs.

Table 7 LtsIdInfo

Parameter

Type

Description

ltsGroupId

String

Log group ID.

ltsAccessStreamID

String

Log stream ID for access logs

ltsAttackStreamID

String

Log stream ID for attack logs

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

The following example shows how to update the LTS configuration in a project. The project ID is specified by project_id. The new LTS configuration ID is c89a667487734f6a95e9967d1f373c77. LTS for WAF logging is enabled. Log group ID: 4bcff74d-f649-41c8-8325-1b0a264ff683. Access og stream ID: 0a7ef713-cc3e-418d-abda-85df04db1a3c. Attack log stream ID: f4fa07f6-277b-4e4a-a257-26508ece81e6

GET https://{Endpoint}/v1/{project_id}/waf/config/lts/c89a667487734f6a95e9967d1f373c77?enterprise_project_id=0

{
  "enabled" : true,
  "ltsIdInfo" : {
    "ltsAccessStreamID" : "4bcff74d-f649-41c8-8325-1b0a264ff683",
    "ltsAttackStreamID" : "0a7ef713-cc3e-418d-abda-85df04db1a3c",
    "ltsGroupId" : "f4fa07f6-277b-4e4a-a257-26508ece81e6"
  }
}

Example Responses

Status code: 200

Request succeeded.

{
  "enabled" : true,
  "id" : "c89a667487734f6a95e9967d1f373c77",
  "ltsIdInfo" : {
    "ltsAccessStreamID" : "4bcff74d-f649-41c8-8325-1b0a264ff683",
    "ltsAttackStreamID" : "0a7ef713-cc3e-418d-abda-85df04db1a3c",
    "ltsGroupId" : "f4fa07f6-277b-4e4a-a257-26508ece81e6"
  }
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.