Skip to content

Instantly share code, notes, and snippets.

@msato0731
Last active April 27, 2018 22:07
Show Gist options
  • Save msato0731/ad88d5c6e045cb6c2367a6cb996753e5 to your computer and use it in GitHub Desktop.
Save msato0731/ad88d5c6e045cb6c2367a6cb996753e5 to your computer and use it in GitHub Desktop.
import boto3
import datetime
def lambda_handler(event, context):
d = datetime.datetime.now()
date = d.strftime("%Y-%m-%d")
logs = 'error/postgresql.log.' + date
rds_client = boto3.client('rds')
rds_response = rds_client.download_db_log_file_portion(
DBInstanceIdentifier='hostname',
LogFileName=logs
)
print(rds_response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment