So I'm new to both python and AWS/Lambda and I'm having some trouble. I want to read cloudwatch logs using boto3 but it doesn't work. When I run the code below in AWS, I get the following error:
An error occurred during JSON serialization of response: AttributeError("'CloudWatchLogs' object has no attribute 'start_query'",) is not JSON serializable
import boto3
import time
boto_client = boto3.client('logs')
def start_query(query):
current_time = time.time()
response = boto_client.start_query(
logGroupName='app-start-logging',
startTime=current_time,
endTime=current_time - 86400,
queryString=query
)
return response
I have followed the documentation on https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/logs.html#CloudWatchLogs.Client.start_query
import botocore- al76