All Products
Search
Document Center

Data Management:GetOpLog

Last Updated:Aug 27, 2026

Queries operation logs within a specified time range.

Operation description

Only users whose role is administrator, DBA, or security administrator can call this operation. You can call the ListUsers or GetUser operation to obtain your user role from the RoleIdList parameter in the response.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dms:GetOpLog

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Tid

integer

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:

  • PERMISSION: permissions

  • OWNER: data owner

  • SQL_CONSOLE: SQL console

  • SQL_CONSOLE_EXPORT: SQL console result 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 address whitelist

  • NDDL: schema design

  • DSQL_CONSOLE: cross-database data query

  • DSQL_CONSOLE_EXPORT: cross-database query result export

  • DB_EXPORT: database export

  • DATA_TRACT: data tracking

  • DATA_QUALITY: data quality

  • DATALINK_MANAGE: DBLink management

  • DATASEC_MANAGE: sensitive data management

  • SELL: sales

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

  • 50

  • 100

30

PageNumber

integer

Yes

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

1

UserNick

string

No

The display name of the user in DMS.

test_name

DatabaseName

string

No

The name of the database.

dmstest@rm-bp1qb97d4b****.mysql.rds.aliyuncs.com:3306[poc_dev]

Response elements

Element

Type

Description

Example

object

TotalCount

integer

The total number of operation logs that are returned.

1

RequestId

string

The ID of the request.

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

ErrorCode

string

The error code.

403

OpLogDetails

object

OpLogDetail

array<object>

The details of the operation log.

object

The details of the operation log.

Module

string

The functional module for which the operation log is queried.

SECURITY_RULE

Database

string

The endpoint of the database instance.

Note
  • This parameter is valid only for database instances of the LocalInstance type.

  • This parameter is valid only for operations on the functional modules related to tasks.

dmstest@rm-bp1qb97d4b****.mysql.rds.aliyuncs.com:3306[poc_dev]

UserId

string

The ID of the Alibaba Cloud account.

22275482072787****

OpUserId

integer

The ID of the user who performed the operation.

51****

OpContent

string

The details of the operation.

SELECT * FROM `orders` \n LIMIT 20

UserNick

string

The display name of the user.

test_name

OrderId

integer

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.

509****

OpTime

string

The time when the operation was performed.

2022-03-28 16:45:19

ErrorMessage

string

The error message returned if the request failed.

UnknownError

Success

boolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

Examples

Success response

JSON format

{
  "TotalCount": 1,
  "RequestId": "47D56208-DB1D-4FD3-BE32-300E43185488",
  "ErrorCode": "403",
  "OpLogDetails": {
    "OpLogDetail": [
      {
        "Module": "SECURITY_RULE",
        "Database": "dmstest@rm-bp1qb97d4b****.mysql.rds.aliyuncs.com:3306[poc_dev]",
        "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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.