How to get all error logs from aws cloudwatch using boto3

316 Views Asked by At

I am trying to get all the error logs from aws cloudwatch, to do this I tried looping through all log group names and running this code:

client.start_query(
    logGroupName=group, # log group name
    startTime = int(creation_time)*1000,  # Time the log group was created
    endTime = int(last_event_time.timestamp() * 1000),  # current datetime
    queryString='filter @message like /ERROR/',
)

But start_query timeouts after 15 mins, and the only workaround would be limiting time range and this doesn't seem to be a viable option because I wouldn't know what time range would work.
What would be a better approach for this?

0

There are 0 best solutions below