tencent cloud

TencentDB for DBbrain

DescribeDBAuditLogs

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-10-15 15:39:47

1. API Description

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

Queries the audit log details of a specified instance within a time window, support by SQL type, execution time, error code, keyword, and other multi-condition filtering. Currently only support dcdb and mariadb products (cdb and cynosdb have been migrated to the central platform). Note that Filter.MultiSql and Filter.ExcludeMultiSql need to be transmitted as a JSON string in the form of a two-dimensional array, for example, [["a","b"]] means (a OR b), and the server will automatically parse it.

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: DescribeDBAuditLogs.
Version Yes String Common Params. The value used for this API: 2021-05-27.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
Product Yes String

Service product type. Currently, Cloud API only supports: dcdb, mariadb (cdb and cynosdb have been migrated to the central platform).

StartTime Yes String

Start time, format yyyy-MM-dd HH:mm:ss.

EndTime Yes String

End time, format: yyyy-MM-dd HH:mm:ss.

InstanceId No String

Instance ID, required. In dcdb and mariadb scenarios, query audit logs by instance dimension.

LogType No String

Log type: Proxy log, DB database log, All.

SortBy No String

Sorting field. Default: Timestamp.

OrderBy No String

Sorting method: ASC for ascending order, DESC for descending order. Default: DESC.

Offset No Integer

Offset. Default value: 0.

Limit No Integer

Number of returned results. Default: 20. Maximum: 100.

SqlStartTime No Integer

SQL start time (millisecond-level timestamp), used when performing a join query by QueryId.

Filter No AuditLogQueryFilter

A collection of query filter criteria for audit logs.

ClusterId No String

Cluster ID. Query audit logs for the dcdb product at the cluster level

3. Output Parameters

Parameter Name Type Description
TotalCount Integer

Total number of eligible entries.

FilteredRecords Integer

Number of records after filtering.

ProxyLogs Array of AuditProxyLogItem

Proxy layer audit log list. Returned when LogType=Proxy or All. For field structure, see AuditProxyLogItem.

DBLogs Array of AuditDBLogItem

DB layer audit log list. Returned when LogType is DB or All. For the field structure, see AuditDBLogItem.

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 Querying mariadb Proxy Audit Logs

This example shows you how to query the Proxy audit log of a mariadb instance. MultiSql uses a JSON string to carry a two-dimensional array.

Input Example

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

{
    "Product": "mariadb",
    "InstanceId": "tdsql-1zsrqfdkh4",
    "LogType": "Proxy",
    "StartTime": "2026-10-10 11:05:06",
    "EndTime": "2026-10-10 12:05:06",
    "Limit": 20,
    "Offset": 0,
    "Filter": {
        "SqlType": [
            "SELECT",
            "INSERT"
        ],
        "ExecTime": [
            100,
            200
        ],
        "ErrCode": "0",
        "MultiSql": "[[\"a\",\"b\"]]",
        "DBName": [
            "da"
        ],
        "User": [
            "dfg"
        ],
        "Host": [
            "123.1.1.1"
        ],
        "ThreadId": [
            "12301"
        ]
    }
}

Output Example

{
    "Response": {
        "RequestId": "ed279d8b-a9d9-48d6-9429-e0fde000994a",
        "TotalCount": 1,
        "FilteredRecords": 0,
        "ProxyLogs": [
            {
                "Timestamp": "2026-10-10 18:19:39",
                "ClusterId": "tdsql-1zsrqfdkh4",
                "User": "shine",
                "Host": "11.161.84.21",
                "DBName": "",
                "Sql": "/*p=dmc,o=100047808302,i=121ea724*/ CREATE DATABASE `test` DEFAULT CHARACTER SET = utf8mb4 DEFAULT COLLATE = utf8mb4_0900_ai_ci;",
                "SqlType": "Create",
                "SqlTemplate": "Create",
                "SqlTemplateId": "2026540316",
                "ComType": "COM_QUERY",
                "ExecTime": 255,
                "SqlStartTime": 1791627579927,
                "SqlStartTimeUs": 927490,
                "ThreadId": "513208377",
                "ProxyHost": "30.122.175.73:24717",
                "ProxyThread": "57875",
                "Autocommit": "1",
                "HoldConns": "1",
                "NewConnNum": 0,
                "AffectRows": 0,
                "SentRows": 0,
                "ErrCode": "1044",
                "ErrInfo": "Access denied for user 'shine'@'%' to database 'test'",
                "BusinessCode": "i=121ea724,o=100047808302,p=dmc",
                "BusinessTag": ""
            }
        ]
    }
}

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
AuthFailure CAM signature/authentication error.
DryRunOperation DryRun operation means the request will be successful, but the DryRun parameter is passed.
FailedOperation Operation failed.
FailedOperation.AuditNotOpened Instance audit is not enabled.
FailedOperation.PaasAuditNotOpened Commercial audit status is not enabled on the paas side.
FailedOperation.SegmentLoading Data loading
InternalError Internal error.
InternalError.DbOperationFailed Database operation failed.
InternalError.InternalError InternalError.InternalError
InvalidFilter Invalid Filter
InvalidParameter Parameter error.
InvalidParameter.InvalidParameter InvalidParameter.InvalidParameter
InvalidParameterCombination Invalid parameter combination
InvalidParameterValue Parameter value error.
InvalidParameterValue.InvalidParameterValue InvalidParameterValue.InvalidParameterValue
LimitExceeded The quota limit is exceeded.
MissingParameter Parameters are missing.
MissingParameter.MissingParameter MissingParameter.MissingParameter
OperationDenied Operation denied.
OperationDenied.UserHasNoStrategy CAM authentication error.
RegionError Region error
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInUse The resource is occupied.
ResourceInsufficient Insufficient resources.
ResourceNotFound The resource does not exist.
ResourceUnavailable Resources are unavailable.
ResourcesSoldOut Resources have been sold out.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.UnauthorizedOperation UnauthorizedOperation.UnauthorizedOperation
UnknownParameter Unknown parameter error.
UnsupportedOperation The operation is not supported.
UnsupportedOperation.HasDuplicatedTask Audit logs within the time range downloaded

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック