79100308

Date: 2024-10-18 02:07:43
Score: 3.5
Natty:
Report link

I am trying to get the status of lambda function as failed or successful based on the presence of error/exceptions along with the timestamp of lambda start and end time to be shown in cloudwatch dashboard. I am succesfull in getting the timestamps but not sure how to get the status. here is what i have tried:

fields @timestamp, @message, @type
| filter @type in ["START", "END", "REPORT"] or @message like /(?i)(error|exception)/
| parse @message /(?[0-9a-f-]{36})/
| parse @log //aws/lambda/(?[^/]+)/
| stats
earliest(@timestamp) as start_time,
latest(@timestamp) as end_time,
count(*) as total_count,
count(@message like /(?i)(error|exception)/ or @message like /Task timed out/ or @message like /Function Error/) as error_count
by functionName, requestId
| sort by start_time desc
| fields
functionName,
requestId,
start_time,
end_time,
(error_count > 0) as failed,
(error_count = 0) as successful
| limit 100

Reasons:
  • Blacklisted phrase (1): I am trying to
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @timestamp
  • User mentioned (0): @message
  • User mentioned (0): @type
  • User mentioned (0): @type
  • User mentioned (0): @message
  • User mentioned (0): @message
  • User mentioned (0): @log
  • User mentioned (0): @message
  • User mentioned (0): @message
  • Low reputation (1):
Posted by: ameer hamza