botocore icon indicating copy to clipboard operation
botocore copied to clipboard

botocore | RDS | downloadlogfile doesn't work ometimes have problem with processing specific log files, for example if log file contain non printable sign

Open gidimariastorm opened this issue 10 years ago • 2 comments

Hi, I have a problem using both aws-cli(latest version) and boto3. Both are botocore based.

I've opened a ticket to aws support and he told me:

I understand that you are having unexpected behaviour when trying to display the slow query log for your instance and are encountering the following error message "A** client error (InvalidParameterValue) occurred when calling the DownloadDBLogFilePortion operation: This file contains binary data and should be downloaded instead of viewed**.".

It appears that you are hitting a known issue with downloading log files that contain non printable sign

This error my boto3 command is the following:

rds=boto3.client('rds',SOURCE_REGION,aws_access_key_id=DEFAULT_ACCESS_KEY,aws_secret_access_key=DEFAULT_SECRET_KEY)

log_file=rds.download_db_log_file_portion(DBInstanceIdentifier="my-rds",LogFileName‌​="slowquery/my-slowquery.log")

the boto3.client is a wrapper that calls the client function of botocore.

If think that the problem is here https://github.com/boto/botocore/blob/7384364df5b7f438678ad0777f07ce37c39e9f59/botocore/data/rds/2014-09-01/service-2.json

because the LogFileData is "string"

I have to say that the most part of time the function works. Can you fix the problem? I

Giuseppe

gidimariastorm avatar May 05 '16 09:05 gidimariastorm

I am a little confused. Let me see if I understand. You are running this:

rds=boto3.client('rds', SOURCE_REGION,
                           aws_access_key_id=DEFAULT_ACCESS_KEY,
                           aws_secret_access_key=DEFAULT_SECRET_KEY
)
log_file=rds.download_db_log_file_portion(
    DBInstanceIdentifier="my-rds",LogFileName‌​="slowquery/my-slowquery.log")

But that is causing the following error?

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

If so, that is looking like the error is coming from the service. You can confirm this as well by adding the line ``boto3.set_stream_logger('botocore') to that client call and you should see RDS responding with that error. If it was an issue with the model, I would expect that boto3 should be receiving a successful HTTP response from rds and then boto3 having encoding issues. Could you possibly confirm where the error is propagating from?

kyleknap avatar May 05 '16 20:05 kyleknap

Closing due to inactivity.

kyleknap avatar May 23 '16 19:05 kyleknap