Domain name for API request: cynosdb.intl.tencentcloudapi.com.
This API is used to query database audit logs.
A maximum of 20 requests can be initiated per second for this API.
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: DescribeAuditLogs. |
| Version | Yes | String | Common Params. The value used for this API: 2019-01-07. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| InstanceId | Yes | String | Instance ID. |
| StartTime | Yes | String | Start time in the format of "2017-07-12 10:29:20". |
| EndTime | Yes | String | End time in the format: "2017-07-12 10:29:20". |
| Order | No | String | Sort order. Supported values: "ASC" - Ascending order, "DESC" - Descending order. |
| OrderBy | No | String | Sorting field. Supported values include: timestamp "affectRows" - Number of affected rows "execTime" - Execution time. |
| Limit | No | Integer | Pagination parameter. Number of data entries returned per request. Default value: 100. Maximum value: 100. |
| Offset | No | Integer | Pagination offset. Description: The sum of Limit and Offset must be less than or equal to 65536. |
| LogFilter.N | No | Array of InstanceAuditLogFilter | Filter criteria. Multiple values have an AND relationship. |
| Parameter Name | Type | Description |
|---|---|---|
| TotalCount | Integer | Number of eligible audit log entries. |
| Items | Array of AuditLog | Audit log details. |
| 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. |
POST / HTTP/1.1
Host: cynosdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeAuditLogs
<Common request parameters>
{
"InstanceId": "cynosdbmysql-ins-qwerasdf",
"StartTime": "2023-08-01 00:00:00",
"EndTime": "2023-08-07 00:00:00",
"Limit": 20,
"LogFilter": [
{
"Type": "sql",
"Compare": "WINC",
"Value": [
"select"
]
},
{
"Type": "sql",
"Compare": "WINC",
"Value": [
"test_db"
]
},
{
"Type": "host",
"Compare": "NEQ",
"Value": [
"10.0.0.1",
"100.0.0.1"
]
}
]
}
{
"Response": {
"Items": null,
"RequestId": "90d90456-2a5b-4015-81b8-9e2fca52012b",
"TotalCount": 0
}
}
sql sample: select * from test_db limit 1;
sql INC SELECT can search for results.
Unable to find a sample for sql WINC select.
POST / HTTP/1.1
Host: cynosdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeAuditLogs
<Common request parameters>
{
"InstanceId": "cynosdbmysql-ins-qwerasdf",
"StartTime": "2023-08-01 00:00:00",
"EndTime": "2023-08-07 00:00:00",
"Limit": 20,
"LogFilter": [
{
"Type": "sql",
"Compare": "INC",
"Value": [
"selec",
"up"
]
},
{
"Type": "host",
"Compare": "INC",
"Value": [
"10.0."
]
}
]
}
{
"Response": {
"Items": null,
"RequestId": "90d90456-2a5b-4015-81b8-9e2fca52012b",
"TotalCount": 0
}
}
This API is used to query an audit log.
POST / HTTP/1.1
Host: cynosdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeAuditLogs
<Common request parameters>
{
"InstanceId": "cynosdbmysql-ins-qwerasdf",
"StartTime": "2017-07-12 10:29:20",
"EndTime": "2017-07-13 10:29:20"
}
{
"Response": {
"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
"TotalCount": 1,
"Items": [
{
"PolicyName": "sys_default",
"ExecTime": 0,
"Timestamp": "2023-06-26 10:32:36.000",
"AffectRows": 0,
"ThreadId": 0,
"TableName": "",
"ErrCode": 0,
"Host": "10.0.0.1",
"SentRows": 0,
"User": "andy",
"Sql": "SELECT * FROM test LIMIT 1;",
"SqlType": "SELECT",
"InstanceName": "cynosdbandy",
"DBName": "db1"
}
]
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation.DatabaseAccessError | Database access failed. Try again later. If the issue persists, contact customer service. |
| FailedOperation.ServiceAccessError | Log query failed. Narrow down the query range. If the issue persists, contact customer service. |
| InternalError.HttpError | Network error. |
| InternalError.ListInstancesError | Query instance error |
| InvalidParameter.ExceptionParam | Parameter error. |
| InvalidParameter.InvalidParameterError | Unknown parameter. Check whether the parameter is valid. |
| InvalidParameterValue.InvalidParameterValueError | Parameter value is invalid. |
文档反馈