AWS |博托3 | RDS |function DownloadDBLogFilePortion |无法下载日志文件,因为它包含二进制数据|

AWS | Boto3 | RDS |function DownloadDBLogFilePortion |cannot download a log file because it contains binary data |

当我尝试从 RDS 实例下载所有日志文件时,在某些情况下,我在 python 输出中发现了这个错误:

An error occurred (InvalidParameterValue) when calling the DownloadDBLogFilePortion operation: This file contains binary data and should be downloaded instead of viewed.

我正确地管理了分页和节流(使用标记参数和睡眠功能)。

这是我的使命:

log_page=request_paginated(rds,DBInstanceIdentifier=id_rds,LogFileName=log,NumberOfLines=1000)

rds->boto3 资源

这是我函数的定义:

def request_paginated(rds,**kwargs):
     return rds.download_db_log_file_portion(**kwargs)

就像我说的,这个功能大部分时间都有效,但有时它 returns:

"An error occurred (InvalidParameterValue) when calling the DownloadDBLogFilePortion operation: This file contains binary data and should be downloaded instead of viewed"

你能帮帮我吗? :)

更新:问题是下载包含不可打印标志的日志文件的已知问题。我将尽快尝试 aws 支持

提供的建议解决方案

最新更新:这是我与 aws 支持团队讨论的摘录:

使用基于 boto 的 AWS cli 时存在非二进制字符的已知问题,但使用基于 Java 的旧 cli 时不存在此问题。

目前无法解决您在使用基于 boto 的 AWS cli 时遇到的问题,解决方法是从基于 Java 的 cli[=15] 进行 API 调用=]

aws 团队已经意识到这个问题并正在努力解决这个问题,但是他们没有关于何时发布的预计到达时间。 所以解决方案是:使用java API

朱塞佩

http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonErrors.html

InvalidParameterValue : An invalid or out-of-range value was supplied for the input parameter.

boto 中的无效参数意味着数据传递不符合要求。可能是您指定的名称无效,可能是您的变量 id_rds 有问题,或者您的 LogFileName 等。您必须遵守函数参数要求。

response = client.download_db_log_file_portion(
  DBInstanceIdentifier='string',
  LogFileName='string',
  Marker='string',
  NumberOfLines=123
)

(更新) 例如,LogFileName 必须是 RDS 实例中存在的确切文件名。

对于日志文件,请确保日志文件存在于实例中。使用此 AWS CLI 进行快速检查

aws rds describe-db-log-files --db-instance-identifier <my-rds-name> 

同时检查 Marker(字符串)和 NumberOfLines(整数)。类型不匹配或超出范围。跳过它们,因为它们不是必需的,稍后再测试。

最新更新:这是我与 aws 支持团队讨论的摘录:

使用基于 boto 的 AWS cli 时存在非二进制字符的已知问题,但是使用基于 Java 的较旧的 cli 时不存在此问题。

目前无法解决您在使用基于 boto 的 AWS cli 时遇到的问题,解决方法是从基于 Java 的 cli[=10] 进行 API 调用=]

aws 团队已经意识到这个问题,并且正在努力解决这个问题,但是他们没有关于何时发布的预计到达时间。所以解决方法是:使用javaAPI

朱塞佩