tencent cloud

TencentDB for MySQL

ModifyDBInstanceLogToCLS

Download
Focus Mode
Font Size
Last updated: 2026-06-09 16:30:25

1. API Description

Domain name for API request: cdb.intl.tencentcloudapi.com.

This API is used to enable or disable the feature of sending CDB slow and error logs to CLS.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyDBInstanceLogToCLS.
Version Yes String Common Params. The value used for this API: 2017-03-20.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
InstanceId Yes String

Instance ID, which can be obtained through the DescribeDBInstances API.

LogType Yes String

Log type. Error: error log, slowlog: slow log.

Status Yes String

Delivery status. ON: enabled, OFF: disabled.

CreateLogset No Boolean

Whether required to create logset. Default to false.

Logset No String

Logset name when creating a logset; logset ID when selecting an existing logset. Empty by default.
Description: When the Status parameter is ON, either the Logset or LogTopic parameter must be filled.

CreateLogTopic No Boolean

Whether required to create log topic. Default to false.

LogTopic No String

Enter a log topic name when creating a log topic, or enter a log topic ID when selecting an existing log topic. Empty by default.
Description: When the Status parameter is set to ON, either the Logset or LogTopic parameter must be specified.

Period No Integer

Valid period of the log topic. Default value: 30 days if left empty. Maximum value: 3600 days.

CreateIndex No Boolean

Whether to create an index when creating a log topic. Defaults to false.

ClsRegion No String

CLS region. If left empty, it defaults to the Region parameter value.

ResourceTags.N No Array of TagInfoItem

Selectable when creating a log topic. Cannot exceed 10 tags

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Turning On or Off CDB Log Delivery to CLS

Ship slow logs and error logs of a CDB instance to CLS.

Input Example

POST / HTTP/1.1
Host: cdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceLogToCLS
<Common request parameters>

{
    "InstanceId": "cdb-ewa3b",
    "LogType": "error",
    "Status": "ON",
    "CreateLogset": true,
    "Logset": "sub_fyrtjbqw",
    "CreateLogTopic": true,
    "LogTopic": "my_test",
    "Period": 1,
    "CreateIndex": true
}

Output Example

{
    "Response": {
        "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.UnknownError Unknown error
InvalidParameter.ControllerNotFoundError This API was not found.
InvalidParameter.InvalidParameterError Invalid parameter value
InvalidParameter.JsonUnmarshalError Failed to deserialize JSON.
MissingParameter.MissingParamError Required parameters are missing.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback