Queries the details about operation logs that are generated within a specified period.
Prerequisites: You are an administrator of Data Management (DMS) or a security administrator. You can call the ListUsers or GetUser operation to obtain your user role from the RoleIdList parameter that is returned.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetOpLog |
The operation that you want to perform. Set the value to GetOpLog. |
Tid | Long | Yes | 3*** |
The ID of the tenant. You can call the GetUserActiveTenant or ListUserTenants operation to obtain the tenant ID. |
Module | String | No | SECURITY_RULE |
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:
|
StartTime | String | Yes | 2022-03-23 10:00:00 |
The beginning of the time range to query. Specify the time in the yyyy-MM-DD HH:mm:ss format. |
EndTime | String | Yes | 2022-03-29 10:00:00 |
The end of the time range to query. Specify the time in the yyyy-MM-DD HH:mm:ss format. |
PageSize | Integer | Yes | 30 |
The number of entries to return on each page. Valid values:
|
PageNumber | Integer | Yes | 1 |
The number of the page to return. Pages start from page 1. |
RegionId | String | No | cn-hangzhou |
The ID of the region in which DMS is activated. For more information about the valid values of this parameter, see RegionID parameter. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
TotalCount | Long | 1 |
The total number of operation logs that are returned. |
RequestId | String | 47D56208-DB1D-4FD3-BE32-300E43185488 |
The ID of the request. |
ErrorCode | String | 403 |
The error code returned if the request fails. |
OpLogDetails | Array of OpLogDetail |
The details of the operation log. |
|
OpLogDetail | |||
Module | String | SECURITY_RULE |
The functional module for which the operation log is queried. |
Database | String | dmstest_prod_database@dmstest.rds...[Test instance] |
The endpoint of the database instance. Note
|
UserId | String | 22275482072787**** |
The UID of the Alibaba Cloud account. |
OpUserId | Long | 51**** |
The ID of the user who performed the operation. |
OpContent | String | SELECT * FROM `orders` \n LIMIT 20 |
The details of the operation. |
UserNick | String | test_name |
The display name of the user. |
OrderId | Long | 509**** |
The ID of the ticket or task. Note This parameter is valid only for operations on the functional modules related to tasks
and the task management module in system management.
|
OpTime | String | 2022-03-28 16:45:19 |
The time when the operation was performed. |
ErrorMessage | String | UnknownError |
The error message returned if the request fails. |
Success | Boolean | true |
Indicates whether the request is successful. Valid values:
|
Examples
Sample requests
http(s)://dms-enterprise.aliyuncs.com/?Action=GetOpLog
&Tid=3***
&Module=SECURITY_RULE
&StartTime=2022-03-23 10:00:00
&EndTime=2022-03-29 10:00:00
&PageSize=30
&PageNumber=1
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetOpLogResponse>
<TotalCount>1</TotalCount>
<RequestId>47D56208-DB1D-4FD3-BE32-300E43185488</RequestId>
<OpLogDetails>
<OpUserId>51****</OpUserId>
<UserId>22275482072787****</UserId>
<Database>dmstest_prod_database@dmstest.rds...[Test instance]</Database>
<OpContent>SELECT * FROM `orders` \n LIMIT 20</OpContent>
<UserNick>test_name</UserNick>
<Module>SECURITY_RULE</Module>
<OpTime>2022-03-28 16:39:44</OpTime>
</OpLogDetails>
<Success>true</Success>
</GetOpLogResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TotalCount" : 1,
"RequestId" : "47D56208-DB1D-4FD3-BE32-300E43185488",
"OpLogDetails" : [ {
"OpUserId" : "51****",
"UserId" : "22275482072787****",
"Database": "dmstest_prod_database@dmstest.rds...[Test instance]",
"OpContent" : "SELECT * FROM `orders` \\n LIMIT 20",
"UserNick" : "test_name",
"Module": "SECURITY_RULE",
"OpTime" : "2022-03-28 16:39:44"
} ],
"Success" : true
}
Error codes
For a list of error codes, visit the Error Center.
SDK sample code
For 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("Enter 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