You can call the DescribeBinlogFiles operation to query the log backup files of an ApsaraDB RDS instance.

  • If the return value of the DownloadLink parameter is NULL for a log backup file, ApsaraDB RDS does not provide a URL from which you can download the file.
  • If the return value of the DownloadLink parameter is not NULL for a log backup file, ApsaraDB RDS provides a URL from which you can download the file. The expiration time of the provided URL is specified by the LinkExpiredTime parameter. You must download the file before the expiration time.
  • This operation returns SQL log entries that are generated over a specified time range. The beginning of the time range must be later than or equal to the time that is specified by the LogEndTime parameter. In addition, the end of the time range must be earlier than or equal to the time that is specified by the LogBeginTime parameter.
Note This operation is not supported for instances that run SQL Server.

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 DescribeBinlogFiles

The operation that you want to perform. Set the value to DescribeBinlogFiles.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

EndTime String Yes 2011-06-20T15:00:00Z

The end of the time range to query. The end time must be later than the start time. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

StartTime String Yes 2011-06-01T15:00:00Z

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

PageSize Integer No 30

The number of entries to return on each page. Valid values: 1 to 100. Default value: 30.

PageNumber Integer No 1

The number of the page to return. Valid values: any non-zero positive integer.

Default value: 1.

Response parameters

Parameter Type Example Description
TotalRecordCount Integer 100

The total number of log backup files returned.

PageNumber Integer 1

The page number of the returned page.

PageRecordCount Integer 30

The number of log backup files returned on the current page.

Items Array of BinLogFile

An array that consists of log backup files.

BinLogFile
FileSize Long 2269410

The size of the log backup file. Unit: bytes.

LogBeginTime String 2019-02-09T17:45:21Z

The start time of the log data that is recorded in the log backup file. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

LogEndTime String 2019-02-15T13:10:28Z

The end time of the log data that is recorded in the binary log file. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

DownloadLink String http://rdsxxxxx.oss.aliyuncs.com/xxxxxx

The URL from which you can download the log backup file over HTTP. If this parameter is set to NULL, no URL is unavailable.

HostInstanceID String 5841973

The ID of the instance that generates the log backup file. You can use this parameter to distinguish between the log backup files generated by a primary instance and the log backup files generated by the secondary instance of the primary instance.

LinkExpiredTime String 2013-06-09T18:00:00Z

The expiration time of the URL. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Checksum String 18358304393468701857

The checksum. The value of this parameter is calculated by the CRC64 algorithm.

IntranetDownloadLink String http://rdslog-hz-v3.oss-cn-hangzhou-internal.aliyuncs.com/xxxxxx

The URL from which you can download the URL of the log backup file over an internal network.

LogFileName String 000000040000000000000019

The name of the log backup file.

RemoteStatus String Completed

The status of the log backup file in the object storage service (OSS) bucket in which the file is stored. Valid values:

  • Uploading: The log backup file is being uploaded to the OSS bucket.
  • Completed: The log backup file has been uploaded to the OSS bucket.
RequestId String ED169A3E-1657-4104-82AB-24EA8CD0DB75

The ID of the request.

TotalFileSize Long 2269410

The total size of the log backup files returned.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribeBinlogFiles
&DBInstanceId=rm-uf6wjk5xxxxxxx
&StartTime=2011-06-01T15:00:00Z
&EndTime=2011-06-20T15:00:00Z
&<Common request parameters>

Sample success responses

XML format

<DescribeBinlogFilesResponse>
<?xml version="1.0" encoding="UTF-8" ?>
<TotalRecordCount>1</TotalRecordCount>
<PageRecordCount>1</PageRecordCount>
<RequestId>C91A2FEA-DDBE-5BE1-9944-9C8DA6E45334</RequestId>
<PageNumber>1</PageNumber>
<TotalFileSize>439562</TotalFileSize>
<Items>
    <BinLogFile>
        <DownloadLink>http://rdslog********.aliyuncs.com/mysql-bin.000071</DownloadLink>
        <LogBeginTime>2021-10-13T07:44:37Z</LogBeginTime>
        <LinkExpiredTime>2021-10-17T03:16:50Z</LinkExpiredTime>
        <Checksum>261972378**********</Checksum>
        <LogEndTime>2021-10-13T13:44:39Z</LogEndTime>
        <IntranetDownloadLink>http://rdslog********.aliyuncs.com/mysql-bin.000071</IntranetDownloadLink>
        <RemoteStatus>Completed</RemoteStatus>
        <HostInstanceID>1947****</HostInstanceID>
        <LogFileName>mysql-bin.000071</LogFileName>
        <FileSize>439562</FileSize>
    </BinLogFile>
</Items>
</DescribeBinlogFilesResponse>

JSON format

{
    "TotalRecordCount": 1,
    "PageRecordCount": 1,
    "RequestId": "C91A2FEA-DDBE-5BE1-9944-9C8DA6E45334",
    "PageNumber": 1,
    "TotalFileSize": "439562",
    "Items": {
        "BinLogFile": [
            {
                "DownloadLink": "http://rdslog********.aliyuncs.com/mysql-bin.000071",
                "LogBeginTime": "2021-10-13T07:44:37Z",
                "LinkExpiredTime": "2021-10-17T03:16:50Z",
                "Checksum": "261972378**********",
                "LogEndTime": "2021-10-13T13:44:39Z",
                "IntranetDownloadLink": "http://rdslog********.aliyuncs.com/mysql-bin.000071",
                "RemoteStatus": "Completed",
                "HostInstanceID": 1947****,
                "LogFileName": "mysql-bin.000071",
                "FileSize": 439562
            }
        ]
    }
}

Error codes

Http status code Error code Error message Description
400 ParameterLeastAssociate Must input at least one optional parameter. The error message returned because the restoreTime parameter and the BackupId parameter of the instance cannot be empty at the same time. Specify at least one of the parameters and try again.
404 InvalidDBInstance.NotFound Specified instance does not exist or not support. The error message returned because the instance cannot be found, is deleted, or does not support the operation.
400 ParameterAbsence Necessary parameter is absence. The error message returned because the required parameters are not specified.
403 IncorrectDBInstanceEngine Current DB Instance engine does not support this operation. The error message returned because the database engine of the instance does not support this operation.
403 IncorrectDBInstanceState Current DB instance state does not support this operation. The error message returned because the status of the instance does not support this operation.
403 IncorrectDBInstanceLockMode Current DB instance lock mode does not support this operation. The error message returned because the instance is locked.

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