Queries the logs of a PolarDB cluster, such as primary/secondary failover logs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
polardb:DescribeDBLogFiles |
list |
*DBCluster
|
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 |
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 |
2023-09-20T16:00:00Z |
| LogType |
string |
Yes |
The log type. Valid values:
Valid values:
|
HaSwitchLogList |
| DescribeSimulateSwitchMode |
string |
No |
The mode to query simulation records. Valid values:
|
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,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,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 |
| HaStatus |
integer |
Indicates whether a failover record exists. Valid values:
Valid values:
|
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 |
| 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 |
2025-05-20T03:09:45Z |
| SwitchFinishTime |
string |
The time when the failover was complete. The time is in the |
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:
|
2 |
| StartTime |
string |
The time when the fault simulation started. The time is in the |
2025-02-25T01:05:00Z |
| EndTime |
string |
The time when the fault simulation was complete. The time is in the |
2025-02-10T02:25:00Z |
| EventStartTime |
string |
The time when the system event started. The time is in the |
2025-04-19T01:12:00Z |
| EventFinishTime |
string |
The time when the system event was complete. The time is in the |
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 |
| DstDbType |
string |
The destination database type. Valid values:
|
PolarDBMySQL |
| SimulateStatus |
string |
The fault simulation status. Valid values:
|
1 |
| EventStartTime |
string |
The time when the system event started. The time is in the |
2025-04-19T01:12:00Z |
| EventFinishTime |
string |
The time when the system event was complete. The time is in the |
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 |
2025-04-19T02:12:00Z |
| SimulatePhase |
string |
The fault simulation phase. Valid values:
|
PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION |
| EndTime |
string |
The time when the step was complete. The time is in the |
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 |
| SwitchStepItems |
array<object> |
A list of failover steps. |
|
|
object |
|||
| SimulatePhase |
string |
The fault simulation phase. Valid values:
|
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 |
2025-07-16T02:12:00Z |
| EndTime |
string |
The time when the step was complete. The time is in the |
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 |
| DBNodeId |
string |
The cluster node ID. Note
This parameter is returned only when the |
pi-************* |
| FaultInjectionType |
string |
The fault injection method. Valid values:
|
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 |
| DstDbType |
string |
The destination database type. Valid values:
|
PolarDBMySQL |
| SimulateStatus |
string |
The fault simulation status. Valid values:
|
1 |
| EventStartTime |
string |
The time when the system event started. The time is in the |
2025-04-19T01:12:00Z |
| EventFinishTime |
string |
The time when the system event was complete. The time is in the |
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 |
2024-10-21T02:12:00Z |
| EndTime |
string |
The time when the step was complete. The time is in the |
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 |
| SimulatePhase |
string |
The fault simulation phase. Valid values:
|
PolarDB.MySQL.FaultSimulate.Phase.FAULT_INJECTION |
| DBNodeId |
string |
The node ID. Note
You must specify either the |
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.