Updated on 2025-12-09 GMT+08:00

Querying Slow Query Log Files (SQL Server)

Function

This API is used to query slow query log files.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

rds:log:getSlowLogs

read

instance

- g:EnterpriseProjectId

- g:ResourceTag/<tag-key>

-

-

Constraints

This API is supported only for Microsoft SQL Server.

URI

  • URI format

    GET /v3/{project_id}/instances/{instance_id}/slowlog-files

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    instance_id

    Yes

    ID of the instance to be queried.

    offset

    No

    Index offset.

    If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number.

    limit

    No

    Number of records on each page. Its value range is from 1 to 100. The parameter value is 10 by default if it is not specified.

Request

  • Request parameters

    None

  • URI example

    GET https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/slowlog-files

Response

  • Normal response
    Table 2 Parameters

    Parameter

    Type

    Description

    list

    Array of objects

    Slow log file information. For details, see Table 3.

    total_count

    Integer

    Total number of files.

    Table 3 SlowLogFile field data structure description

    Parameter

    Type

    Description

    file_name

    String

    File name.

    file_size

    String

    File size in bytes.

  • Example normal response
    {
      "total_count" : 1,
      "list" : [ {
        "file_name" : "SQLTrace.trc",
        "file_size" : "1024"
      } ]
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.