Queries detailed information of operation logs generated within a specified period.

For DMS enterprise users administrator you can use this interface to obtain the detailed list of the operations logs generated by the enterprise.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 -1

The ID of the tenant.

Note You can obtain the tenant ID from the image that you hover over your avatar in the upper-right corner of the console. For more information, see view tenant information.
StartTime String Yes 2018-11-01 10:00:00

The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

EndTime String Yes 2018-11-01 11:00:00

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

PageNumber Integer Yes 3

The number of the page to return. Pages start from page 1.

PageSize Integer Yes 30

The number of records on each page. Valid values:

  • 30
  • 50
  • 100
Module String No PERMISSION

The log module. By default, all modules in the specified time range are returned. Valid values of the log module:

  • PERMISSION : Permissions
  • OWNER: Data Owner
  • SQL _CONSOLE : Data Query
  • SQL _CONSOLE_EXPORT : query results export
  • DATA_CHANGE : data change
  • DATA_EXPORT : Data export
  • SQL _REVIEW : SQL review
  • DT_SYNC : database and table synchronization
  • DT_DETAIL : database and table details
  • DB_TASK : Task Management
  • INSTANCE_MANAGE : instance management
  • USER_MANAGE : User Management
  • SECURITY_RULE : security rules
  • CONFIG_MANAGE : Configuration Management
  • RESOURCE_AUTH : Resource Authorization
  • ACCESS_WHITE_IP : Access IP whitelist

Response parameters

Parameter Type Sample response Description
ErrorCode String 403

Error code

ErrorMessage String The specified request parameter is invalid.

Error message

OpLogDetails Array of OpLogDetail

The detailed information of operation logs.

OpLogDetail
Database String dmstest_prod_database@dmstest.rds... [Test instance]

The database endpoint. This parameter takes effect only when the instance type is set LocalInstance this parameter has a value.

Note This parameter is valid only for operations on the functional modules related to tasks.
Module String PERMISSION

The functional module from which the operation log was queried.

OpContent String Apply for permission

The operation that was performed.

OpTime String 2018-11-01 10:00:00

The time when the log was generated.

OrderId Long 1

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 the system management module.
UserId Long 12345678

The unique ID (UID) of the user.

UserNick String dmstest

The display name of the user.

RequestId String 47D56208-DB1D-4FD3-BE32-300E43185488

The ID of the request.

Success Boolean true

Indicates whether the request was successful.

TotalCount Long 22

The total number of operation logs that met the query conditions.

Examples

Sample requests

http(s)://[Endpoint]/? Action=GetOpLog
&Tid=-1
&StartTime=2018-11-01 10:00:00
&EndTime=2018-11-01 11:00:00
&PageNumber=3
&PageSize=30
&<Common request parameters>

Sample success responses

XML format

<OpLogDetails>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = & amp;#39;BASE TABLE & amp;#39; AND 'table_schema' = & amp;#39; dmste_database & amp;#39; AND 'table_name' = & amp;#39;multi_db_multi_tbl & #39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 20:04:10</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = & amp;#39;BASE TABLE & amp;#39; AND 'table_schema' = & amp;#39; dmste_database & amp;#39; AND 'table_name' = & amp;#39;multi_db_multi_tbl & #39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 20:04:06</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded. number of rows: 24)show topology FROM multi_db_multi_tbl</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 20:03:55</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = & amp;#39;BASE TABLE & amp;#39; AND 'table_schema' = & amp;#39; dmste_database & amp;#39; AND 'table_name' = & amp;#39;user_log3 & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 20:02:59</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = & amp;#39;BASE TABLE & amp;#39; AND 'table_schema' = & amp;#39; dmste_database & amp;#39; AND 'table_name' = & amp;#39;user_log3 & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 20:02:49</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded. number of rows: 1)show CREATE TABLE user_log3</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:34:05</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 9)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:33:54</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task. Task ID: 5486.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:26:57</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task. Task ID: 5485.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:23:55</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task. Task ID: 5484.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:23:30</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task. Task ID: 5483.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:23:11</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded. number of rows: 1)show CREATE TABLE multi_db_single_tbl</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:22:30</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 2)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:22:15</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 2)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:19:31</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task.Task ID: 5482.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:19:25</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 1)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:18:57</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>Add an SQL task. Task ID: 5481.</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:18:46</OpTime>
        <Module>DB_TASK</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:04:13</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 14:04:08</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent>(succeeded, number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = & amp;#39;BASE TABLE & amp;#39; AND table_schema = & amp;#39;dmstest_database & amp;#39;</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 12:11:41</OpTime>
        <Module>SQL_CONSOLE</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent> the administrator or DBA edits the database OWNER. database name: dmstest_database@dmstest.rds...(test)</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 12:11:14</OpTime>
        <Module>OWNER</Module>
    </OpLogDetail>
    <OpLogDetail>
        <OpContent> the administrator or DBA edits the database OWNER. database name: dmstest_prod_database@dmstest.rds...(test)</OpContent>
        <UserNick>dmstest</UserNick>
        <Database>dmstest_prod_database@dmstest.rds...(test)</Database>
        <UserId>12345678</UserId>
        <OpTime>2018-11-22 12:11:07</OpTime>
        <Module>OWNER</Module>
    </OpLogDetail>
</OpLogDetails>
<TotalCount>22</TotalCount>
<RequestId>47D56208-DB1D-4FD3-BE32-300E43185488</RequestId>
<Success>true</Success>

JSON format

{
    "OpLogDetails": {
        "OpLogDetail": [{
            "OpContent": "(succeeded. Number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = &#39;BASE TABLE &#39; AND 'table_schema' = &#39;dmstest_database &#39; AND 'table_name' = &#39;multi_db_multi_tbl &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 20:04:10",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = &#39;BASE TABLE &#39; AND 'table_schema' = &#39;dmstest_database &#39; AND 'table_name' = &#39;multi_db_multi_tbl &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 20:04:06",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 24)show topology FROM multi_db_multi_tbl",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 20:03:55",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = &#39;BASE TABLE &#39; AND 'table_schema' = &#39;dmstest_database &#39; AND 'table_name' = &#39;user_log3 &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 20:02:59",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)SELECT (data_length + index_length) AS store_capacity FROM information_schema.tables WHERE table_type = &#39;BASE TABLE &#39; AND 'table_schema' = &#39;dmstest_database &#39; AND 'table_name' = &#39;user_log3 &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 20:02:49",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)show CREATE TABLE user_log3",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:34:05",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 9)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:33:54",
            "Module": "Data Query"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5486",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:26:57",
            "Module": "Task Management"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5485",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:23:55",
            "Module": "Task Management"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5484",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:23:30",
            "Module": "Task Management"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5483",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:23:11",
            "Module": "Task Management"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)show CREATE TABLE multi_db_single_tbl",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:22:30",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 2)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:22:15",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 2)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:19:31",
            "Module": "Data Query"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5482",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:19:25",
            "Module": "Task Management"
        }, {
            "OpContent": "(succeeded. Number of rows: 1)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:18:57",
            "Module": "Data Query"
        }, {
            "OpContent": "Add an SQL task. Task ID: 5481",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:18:46",
            "Module": "Task Management"
        }, {
            "OpContent": "(succeeded. Number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:04:13",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 14:04:08",
            "Module": "Data Query"
        }, {
            "OpContent": "(succeeded. Number of rows: 0)SELECT 'TABLE_NAME' FROM information_schema.tables WHERE TABLE_TYPE = &#39;BASE TABLE &#39; AND table_schema = &#39;dmstest_database &#39;",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 12:11:41",
            "Module": "Data Query"
        }, {
            "OpContent": "The administrator or DBA edits the database OWNER. Database name: dmstest_database@dmstest.rds...(test)",
            "UserNick": "dmstest",
            "Database": "dmstest_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 12:11:14",
            "Module": "Data Owner"
        }, {
            "OpContent": "The administrator or DBA edits the database OWNER. Database name: dmstest_prod_database@dmstest.rds...(test)",
            "UserNick": "dmstest",
            "Database": "dmstest_prod_database@dmstest.rds...(test)",
            "UserId": 12345678,
            "OpTime": "2018-11-22 12:11:07",
            "Module": "Data Owner"
        }]
    },
    "TotalCount": 22,
    "RequestId": "47D56208-DB1D-4FD3-BE32-300E43185488",
    "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.

SDK example

For more information about how to use the SDK, see:alibaba Cloud Python SDK

Example:


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("Your tenant ID")
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