All Products
Search
Document Center

PolarDB:DescribeDBLogFiles

Last Updated:Apr 10, 2026

Queries the logs of a PolarDB cluster, such as primary/secondary failover logs.

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

polardb:DescribeDBLogFiles

list

*DBCluster

acs:polardb:{#regionId}:{#accountId}:dbcluster/{#DbClusterId}

None None

Request parameters

Parameter

Type

Required

Description

Example

DBClusterId

string

Yes

The cluster ID.

pc-*************

DBNodeId

string

No

The ID of the node in the PolarDB cluster.

pi-*************

PageNumber

integer

No

The page number. The value must be an integer that is greater than 0. The default value is 1.

1

PageSize

integer

No

The page size. Valid values: 5 to 50. The default value is 10.

10

StartTime

string

No

The start of the time range to query. The time must be in UTC and formatted as yyyy-MM-ddTHH:mm:ssZ.

2023-08-20T16:00:00Z

EndTime

string

No

The end of the time range to query. The time must be in UTC and formatted as yyyy-MM-ddTHH:mm:ssZ.

2023-09-20T16:00:00Z

LogType

string

Yes

The log type. Valid values:

  • HaSwitchLogList: A list of failover logs.

  • HaSwitchLogInfo: Details of a failover log.

  • SimulateSwitchLogs: Failover simulation logs.

Valid values:

  • HaSwitchLogList :

    HaSwitchLogList

HaSwitchLogList

DescribeSimulateSwitchMode

string

No

The mode to query simulation records. Valid values:

  • 0: Queries the simulation records of a logical instance. You can specify the simulation ID.

  • 1: Queries the simulation records of a physical instance based on a specified SimulateListId.

  • 2: Queries the records of the most recent simulation in progress.

0

SimulateListId

string

No

The ID of a logical instance simulation record.

"95"

SimulateStatusList

string

No

Filters the results by one or more simulation statuses. Specify multiple statuses as a comma-separated string. Valid values:

  • 0: Waiting for scheduling

  • 1: Succeeded

  • 2: Running

  • 3: Failed

  • 4: Interrupted

  • 5: Waiting for switchback

  • 6: Canceled

"0,1,2,3,4,5"

SimulateModeList

string

No

Filters the results by one or more simulation modes. Specify multiple modes as a comma-separated string. Valid values:

  • 0: Fault is injected into the primary availability zone.

  • 1: Fault is injected into the DB instance.

  • 2: Fault is injected into the disaster recovery data center.

0,1,2

Response elements

Element

Type

Description

Example

object

TotalRecords

integer

The total number of records.

1

ItemsNumbers

integer

The number of log items on the current page.

1

PageNumber

integer

The page number. It must be a positive integer that does not exceed the maximum value of the Integer data type. Default value: 1.

1

DBInstanceName

string

The cluster ID.

pc-****************

DBInstanceType

string

The instance type. Valid values:

  • polardb_mysql_rw: read-write instance.

  • polardb_mysql_ro: read-only instance.

  • polardb_mysql_standby: standby instance.

polardb_mysql_rw

HaStatus

integer

Indicates whether a failover record exists. Valid values:

  • 1: No

  • 0: Yes

Valid values:

  • 0 :

    0

  • 1 :

    1

1

HaLogItems

array<object>

A list of failover logs.

object

The failover log.

SwitchId

string

The failover log ID.

e571f897-9b3c-4012-9470-88333832dec4

FromDBType

string

The instance type before the failover. Valid values:

  • polardb_mysql_rw: read-write instance.

  • polardb_mysql_ro: read-only instance.

  • polardb_mysql_standby: standby instance.

polardb_mysql_rw

SwitchCauseCode

string

The error code for the failover cause.

Platform.Ha.AuroraService.ManualOperations

SwitchCauseDetail

string

Details about the failover cause.

Platform.Ha.ManuallyTriggered

SwitchStartTime

string

The time when the failover started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-05-20T03:09:45Z

SwitchFinishTime

string

The time when the failover was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-05-20T03:09:56Z

TotalSessions

integer

The total number of sessions during the failover.

10000

AffectedSessions

integer

The number of affected sessions during the failover.

100

SwitchType

integer

The failover type.

0

RequestId

string

The request ID.

24A1990B-4F6E-482B-B8CB-75C612******

PageSize

integer

The number of entries to return on each page. Valid values: 5 to 50. Default value: 10.

10

SwitchListItems

array<object>

A list of fault simulation records.

array<object>

The fault simulation record.

SimulateListId

string

The fault simulation record ID.

23

SimulateMode

string

The fault simulation mode.

0

SimulateStatus

string

The fault simulation status. Valid values:

  • 0: Pending

  • 1: Success

  • 2: Running

  • 3: Failed

  • 4: Aborted

  • 5: Awaiting rollback

2

StartTime

string

The time when the fault simulation started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-02-25T01:05:00Z

EndTime

string

The time when the fault simulation was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-02-10T02:25:00Z

EventStartTime

string

The time when the system event started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T01:12:00Z

EventFinishTime

string

The time when the system event was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T02:12:00Z

SimulateTaskId

string

The fault simulation task ID.

23

DBNodeCrashList

array

The IDs of nodes on which to simulate a fault.

Note

For a node-level fault simulation, specify the ID of a single node. For an availability zone-level fault simulation, you can either omit this parameter or specify the IDs of all nodes in the zone.

string

The node ID.

pi-bp19v6xsl0u2c1cqq,pi-bp1ap84xmpf4c1c1t

SwitchLogItems

array<object>

A list of fault simulation logs.

array<object>

The fault simulation log.

SimulateListId

string

The simulation list ID.

96

SimulateLogId

string

The simulation log ID.

23

DBInstanceId

string

The cluster ID.

Note

You can call the DescribeDBClusters operation to query the details of your clusters, including the cluster IDs.

pc-*************

SrcDbType

string

The source database type. Valid values:

  • PolarDBMySQL: A major version upgrade of PolarDB for MySQL.

  • RDS: A migration from RDS to PolarDB for MySQL.

PolarDBMySQL

DstDbType

string

The destination database type. Valid values:

  • PolarDBMySQL: A major version upgrade of PolarDB for MySQL.

  • RDS: A migration from RDS to PolarDB for MySQL.

PolarDBMySQL

SimulateStatus

string

The fault simulation status. Valid values:

  • 0: Pending

  • 1: Success

  • 2: Running

  • 3: Failed

  • 4: Aborted

  • 5: Awaiting rollback

1

EventStartTime

string

The time when the system event started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T01:12:00Z

EventFinishTime

string

The time when the system event was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T02:12:00Z

SwitchStepItems

array<object>

A list of fault simulation steps.

object

The fault simulation step.

StepName

string

The name of the current step. You can call the DescribeHistoryTasks operation to query the current step of a specified task. A common value is do_pause, which indicates that the system waits for a specified period of time.

init_task_info

StartTime

string

The time when the step started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T02:12:00Z

SimulatePhase

string

The fault simulation phase. Valid values:

  • PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION: The fault injection phase.

  • PolarDB.MySQL.FaultSimulate.Phase.RECOVERY: The recovery phase.

  • PolarDB.MySQL.FaultSimulate.Phase.POST_PROCESS: The post-processing phase.

PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION

EndTime

string

The time when the step was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-08-14T02:07:00Z

TimeCost

string

The duration of the step in milliseconds.

1000

IsSuccess

string

Indicates whether the step was successful. Valid values:

  • true: The step was successful.

  • false: The step failed.

true

SwitchStepItems

array<object>

A list of failover steps.

object

SimulatePhase

string

The fault simulation phase. Valid values:

  • PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION: The fault injection phase.

  • PolarDB.MySQL.FaultSimulate.Phase.RECOVERY: The recovery phase.

  • PolarDB.MySQL.FaultSimulate.Phase.POST_PROCESS: The post-processing phase.

PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION

StepName

string

The name of the current step. You can call the DescribeHistoryTasks operation to query the current step of a specified task. A common value is do_pause, which indicates that the system waits for a specified period of time.

init_task_info

StartTime

string

The time when the step started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-07-16T02:12:00Z

EndTime

string

The time when the step was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-07-23T02:30:00Z

TimeCost

string

The duration of the step in milliseconds.

1000

IsSuccess

string

Indicates whether the step was successful. Valid values:

  • true: The step was successful.

  • false: The step failed.

true

DBNodeId

string

The cluster node ID.

Note

This parameter is returned only when the Key parameter in the request is not set to PolarDBDiskUsage.

pi-*************

FaultInjectionType

string

The fault injection method. Valid values:

  • CrashSQLInjection: Injects a fault into the instance by using Crash SQL.

CrashSQLInjection

SwitchLogItems

array<object>

A list of fault simulation logs.

array<object>

The fault simulation log.

SimulateListId

string

The simulation list ID.

231

Simulatecode

string

The status code of the fault simulation.

0

DBInstanceId

string

The cluster ID.

Note

You can call the DescribeDBClusters operation to query the details of your clusters, including the cluster IDs.

pc-*************

SrcDbType

string

The source database type. Valid values:

  • PolarDBMySQL: A major version upgrade of PolarDB for MySQL.

  • RDS: A migration from RDS to PolarDB for MySQL.

PolarDBMySQL

DstDbType

string

The destination database type. Valid values:

  • PolarDBMySQL: A major version upgrade of PolarDB for MySQL.

  • RDS: A migration from RDS to PolarDB for MySQL.

PolarDBMySQL

SimulateStatus

string

The fault simulation status. Valid values:

  • 0: Pending

  • 1: Success

  • 2: Running

  • 3: Failed

  • 4: Aborted

  • 5: Awaiting rollback

1

EventStartTime

string

The time when the system event started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T01:12:00Z

EventFinishTime

string

The time when the system event was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-04-19T02:12:00Z

SwitchStepItems

array<object>

A list of failover steps.

object

StepName

string

The name of the step.

init_task_info

StepMsg

string

A message about the execution status of the step.

This step exec success

StartTime

string

The time when the step started. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2024-10-21T02:12:00Z

EndTime

string

The time when the step was complete. The time is in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.

2025-03-27T02:27:00Z

TimeCost

string

The duration of the step in milliseconds.

1000

IsSuccess

string

Indicates whether the step was successful. Valid values:

  • true: The step was successful.

  • false: The step failed.

true

SimulatePhase

string

The fault simulation phase. Valid values:

  • PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION: The fault injection phase.

  • PolarDB.MySQL.FaultSimulate.Phase.RECOVERY: The recovery phase.

  • PolarDB.MySQL.FaultSimulate.Phase.POST_PROCESS: The post-processing phase.

PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION

DBNodeId

string

The node ID.

Note

You must specify either the DBNodeId or DBClusterId parameter. You can call the DescribeDBClusters operation to query the details of your clusters, including the node IDs.

pi-*************

Examples

Success response

JSON format

{
  "TotalRecords": 1,
  "ItemsNumbers": 1,
  "PageNumber": 1,
  "DBInstanceName": "pc-****************",
  "DBInstanceType": "polardb_mysql_rw",
  "HaStatus": 1,
  "HaLogItems": [
    {
      "SwitchId": "e571f897-9b3c-4012-9470-88333832dec4",
      "FromDBType": "polardb_mysql_rw",
      "SwitchCauseCode": "Platform.Ha.AuroraService.ManualOperations",
      "SwitchCauseDetail": "Platform.Ha.ManuallyTriggered",
      "SwitchStartTime": "2025-05-20T03:09:45Z",
      "SwitchFinishTime": "2025-05-20T03:09:56Z",
      "TotalSessions": 10000,
      "AffectedSessions": 100,
      "SwitchType": 0
    }
  ],
  "RequestId": "24A1990B-4F6E-482B-B8CB-75C612******",
  "PageSize": 10,
  "SwitchListItems": [
    {
      "SimulateListId": "23",
      "SimulateMode": "0",
      "SimulateStatus": "2",
      "StartTime": "2025-02-25T01:05:00Z",
      "EndTime": "2025-02-10T02:25:00Z",
      "EventStartTime": "2025-04-19T01:12:00Z",
      "EventFinishTime": "2025-04-19T02:12:00Z",
      "SimulateTaskId": "23",
      "DBNodeCrashList": [
        "pi-bp19v6xsl0u2c1cqq,pi-bp1ap84xmpf4c1c1t"
      ],
      "SwitchLogItems": [
        {
          "SimulateListId": "96",
          "SimulateLogId": "23",
          "DBInstanceId": "pc-*************",
          "SrcDbType": "PolarDBMySQL",
          "DstDbType": "PolarDBMySQL",
          "SimulateStatus": "1",
          "EventStartTime": "2025-04-19T01:12:00Z",
          "EventFinishTime": "2025-04-19T02:12:00Z\n",
          "SwitchStepItems": [
            {
              "StepName": "init_task_info",
              "StartTime": "2025-04-19T02:12:00Z",
              "SimulatePhase": "PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION",
              "EndTime": "2025-08-14T02:07:00Z",
              "TimeCost": "1000",
              "IsSuccess": "true"
            }
          ]
        }
      ],
      "SwitchStepItems": [
        {
          "SimulatePhase": "PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION",
          "StepName": "init_task_info",
          "StartTime": "2025-07-16T02:12:00Z",
          "EndTime": "2025-07-23T02:30:00Z",
          "TimeCost": "1000",
          "IsSuccess": "true",
          "DBNodeId": "pi-*************"
        }
      ],
      "FaultInjectionType": "CrashSQLInjection"
    }
  ],
  "SwitchLogItems": [
    {
      "SimulateListId": "231",
      "Simulatecode": "0",
      "DBInstanceId": "pc-*************",
      "SrcDbType": "PolarDBMySQL",
      "DstDbType": "PolarDBMySQL",
      "SimulateStatus": "1",
      "EventStartTime": "2025-04-19T01:12:00Z",
      "EventFinishTime": "2025-04-19T02:12:00Z",
      "SwitchStepItems": [
        {
          "StepName": "init_task_info",
          "StepMsg": "This step exec success ",
          "StartTime": "2024-10-21T02:12:00Z",
          "EndTime": "2025-03-27T02:27:00Z",
          "TimeCost": "1000",
          "IsSuccess": "true",
          "SimulatePhase": "PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION",
          "DBNodeId": "pi-*************"
        }
      ]
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidDBClusterId.Malformed The specified parameter DBClusterId is not valid.
400 InvalidPageSize.Malformed The specified parameter PageSize is not valid. The specified PageSize parameter is invalid.
400 InvalidPageNumber.Malformed The specified parameter PageNumber is not valid. The specified PageNumber parameter is invalid.
404 InvalidDBCluster.NotFound The DBClusterId provided does not exist in our records. The specified DBClusterId parameter does not exist in the current record.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.