Hi I am trying to get run start query for clouldwatchlogs which can be done using
client = boto3.client('logs')
query = "fields @timestamp, @message | parse @message \"username: * ClinicID: * nodename: *\" as username, ClinicID, nodename | filter ClinicID = 7667 and username='simran+test@abc.com'"
log_group = '/aws/lambda/NAME_OF_YOUR_LAMBDA_FUNCTION'
start_query_response = client.start_query(
logGroupName=log_group,
startTime=int((datetime.today() - timedelta(hours=5)).timestamp()),
endTime=int(datetime.now().timestamp()),
queryString=query,
)
but the problem I am facing is I am using python 2.7 so cant use timestamp .How can i mention startTime & endTime in python2.7 for getting last 24hrs data? I think it can be done using time.time() . Not sure how .Please help