Queries the details of operation logs that are generated in a specified period of time.
Operation description
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Tid | long | No | The ID of the tenant. You can call the GetUserActiveTenant or ListUserTenants operation to query the tenant ID. | 3*** |
Module | string | No | The functional module for which you want to query operation logs. If you do not specify this parameter, operation logs for all functional modules are returned. Valid values:
| SECURITY_RULE |
StartTime | string | Yes | The beginning of the time range to query. Specify the time in the yyyy-MM-DD HH:mm:ss format. | 2022-03-23 10:00:00 |
EndTime | string | Yes | The end of the time range to query. Specify the time in the yyyy-MM-DD HH:mm:ss format. | 2022-03-29 10:00:00 |
PageSize | integer | Yes | The number of entries to return on each page. Valid values:
| 30 |
PageNumber | integer | Yes | The number of the page to return. Pages start from page 1. | 1 |
UserNick | string | No | UserNick. | test_name |
DatabaseName | string | No | DatabaseName. | dmstest@rm-bp1qb97d4b****.mysql.rds.aliyuncs.com:3306[poc_dev] |
Response parameters
Examples
Sample success responses
JSON
format
{
"TotalCount": 1,
"RequestId": "47D56208-DB1D-4FD3-BE32-300E43185488",
"ErrorCode": "403",
"OpLogDetails": {
"OpLogDetail": [
{
"Module": "SECURITY_RULE\n",
"Database": "dmstest_prod_database@dmstest.rds... \\[Test instance]\n",
"UserId": "22275482072787****",
"OpUserId": 0,
"OpContent": "SELECT * FROM `orders` \\n LIMIT 20",
"UserNick": "test_name",
"OrderId": 0,
"OpTime": "2022-03-28 16:45:19"
}
]
},
"ErrorMessage": "UnknownError",
"Success": true
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-04-27 | The request parameters of the API has changed | View Change Details |
2023-04-27 | The request parameters of the API has changed | View Change Details |
SDK sample code
For more information about how to call this operation by using an SDK, see Alibaba Cloud SDK for Python.
Sample code:
from aliyunsdkcore.client import AcsClient
from aliyunsdkdms_enterprise.request.v20181101.GetOpLogRequest import GetOpLogRequest
client = AcsClient(
"<your-access-key-id>",
"<your-access-key-secret>",
"<your-region-id>"
)
request = GetOpLogRequest()
request.set_Tid("The tenant ID of your enterprise")
request.set_StartTime("2018-11-20 00:00:00")
request.set_EndTime("2018-11-23 00:00:00")
request.set_PageNumber(1)
request.set_PageSize(50)
response = client.do_action_with_exception(request)
print response