0

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

user33
  • 1
  • Wouldn't this information be in the documentation? Possibly relevant: https://stackoverflow.com/questions/30020988/python3-datetime-timestamp-in-python2. – AMC Mar 17 '20 at 16:41
  • Still not getting a proper idea here – user33 Mar 18 '20 at 10:36

0 Answers0