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

Associating an Instance with an LTS Log Stream

API Description

After you have associated an instance with a Log Tank Service (LTS) log stream, logs of the instance are automatically uploaded to the associated LTS log stream. You will be billed for log reporting. For details, see LTS pricing details. After a specific log stream is selected, the system creates a structuring rule of the required log type for it.

Constraints

  • This operation cannot be performed on instances in the creating, deleted, or frozen state.
  • A maximum of 100 data records are supported.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dds:instance:saveLogConfig

    write

    -

    -

    -

    -

URI

  • URI format

    POST /v3/{project_id}/instances/logs/lts-configs

  • URI example

    https://dds.cn-north-1.myhuaweicloud.com/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/logs/lts-configs

    Table 1 Request Parameters

    Parameter

    Mandatory

    Type

    Description

    X-Auth-Token

    Yes

    String

    Definition

    User token obtained from IAM. For details, see Authentication.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    project_id

    Yes

    String

    Definition

    Project ID of a tenant in a region. Obtain the project ID by following the instructions in Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request

  • Parameter description
    Table 2 Request body parameters

    Parameter

    Type

    Mandatory

    Description

    lts_configs

    Array of Table 3 objects

    Yes

    Definition

    Each item indicates an LTS configuration for the instance.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    Table 3 lts_configs

    Parameter

    Type

    Mandatory

    Description

    instance_id

    String

    Yes

    Definition

    Instance ID, which can be obtained by calling the API for querying instances and details. If there are no instances available, create one by calling the API used for creating an instance.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    log_type

    String

    Yes

    Definition

    LTS log type.

    Constraints

    This parameter cannot be left blank. The options are as follows:

    • audit_log

    Range

    • audit_log

    Default Value

    N/A

    lts_group_id

    String

    Yes

    Definition

    LTS log group ID. You can obtain the value using the LTS API for querying all log groups under an account.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    lts_stream_id

    String

    Yes

    Definition

    LTS log stream ID. You can obtain the value using the LTS API for querying all log streams in a specified log group.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

  • Example Request

    Enabling audit log reporting to LTS for a DB instance

    POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/logs/lts-configs

    { 
      "lts_configs" : [ { 
        "instance_id" : "520c58ba00a3497e97ce0b9604874dd6in02", 
        "log_type" : "audit_log", 
        "lts_group_id" : "ec6dc499-1a63-4229-a0c2-a2afa8bcfc95", 
        "lts_stream_id" : "cae69d2e-378b-41dd-b3c9-3ca1cd5335bc" 
      } ] 
    }

Response

  • Parameter description

    None

  • Example Response

    None

Status Code

For details, see Status Code.

Error Code

For details, see Error Code.