amazon web services - How do I log event and context information automatically on AWS Lambda function failures? -
i trying log lambda function failures in such way event , context information saved event information can, if deemed necessary, later manually republished function's trigger. not want handle logic in functions themselves.
what i've tried far:
- cloudwatch alarms on error metric. tell me function has failed.
- looking in cloudwatch logs. see coded failure messages emitted each function.
there no such setting, if that's you're looking for.
if you'd these properties logged, have print
them - way visible in cloudwatch
, whatever service logs piped (logs can piped elasticsearch
example, cloudwatch
).
however, can done adding these 2 lines of code:
exports.handler = (event, context, callback) => { console.log(json.stringify(event)); console.log(json.stringify(context)); // code };
as rule of thumb, logs way describing lambda
went through @ each invocation.
Comments
Post a Comment