Help Center/ GeminiDB/ API Reference/ APIs v3 (Recommended)/ Logs/ Associating Instances with an LTS Log Stream
Updated on 2023-12-25 GMT+08:00

Associating Instances with an LTS Log Stream

Function

  • After you have associated instances with a Log Tank Service (LTS) log stream, logs of these instances are automatically uploaded to the associated LTS log stream.
  • You will be billed for log reporting. See LTS pricing details.
  • After a specific log stream is selected, the system creates structuring configurations of the required log type for it. If there are already structuring configurations of another log type in the log stream, they will be overwritten.

Constraints

  • This function supports only slow query logs and audit logs of GeminiDB Redis instances.
  • This function is only available to instances of the latest kernel version.
  • This operation cannot be performed on instances in the creating, deleted, or frozen state.
  • A maximum of 100 instances can be associated with an LTS log stream in a batch.

URI

POST https://{Endpoint}/v3/{project_id}/instances/logs/lts-configs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

X-Language

No

String

Language.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

instance_ids

Yes

Array of strings

IDs of the instances to be associated with an LTS log stream.

log_type

Yes

String

Log type. The value can be:

  • slow_log, indicating that the log is a slow query log.
  • audit_log, indicating that the log is an audit log.

lts_group_id

Yes

String

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

lts_stream_id

Yes

String

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

Response Parameters

Status code: 200

No response parameters

Example Requests

  • URI example
    POST https://{Endpoint}/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/logs/lts-configs 
  • Associating instances with an LTS log stream that supports slow query logs
    { 
      "instance_ids" : [ "fe45815ce8a6413ab7fa290da1db1614in12", "362b42f769ff45d884e1866f8ee00bb4in12" ], 
      "log_type" : "slow_log", 
      "lts_group_id" : "65442dd4-b8de-4e9f-8a80-b60aa0698354", 
      "lts_stream_id" : "5992dd29-fd11-4228-a852-5f6e578789c5" 
    }
  • Associating instances with an LTS log stream that supports audit logs
    { 
      "instance_ids" : [ "fe45815ce8a6413ab7fa290da1db1614in12", "362b42f769ff45d884e1866f8ee00bb4in12" ], 
      "log_type" : "audit_log", 
      "lts_group_id" : "65442dd4-b8de-4e9f-8a80-b60aa0698354", 
      "lts_stream_id" : "5992dd29-fd11-4228-a852-5f6e578789c5" 
    }

Example Responses

Status code: 200

Success

{}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.