I have a lambda that sends to STDERR when a given operation fails, something like:
async function handler(event, context) {
const success = do()
if (success) {
return { statusCode: 200 }
}
console.error('Failed :(')
return { statusCode: 400 }
}
This is very simplified, but you get the idea. Naturally, this message will appear on CloudWatch. I would like to know if it's possible (and how to) setup a CloudWatch Alarm to send me an email if this message shows up in my logs.
I've read the docs about CloudWatch alarms, but It's very cluttered and hard to find anything there.