3

I am looking for the best way to detect errors in cloudwatch logs which are logged by lambda functions, the log output is structured.

I was considering using a metric filter to trigger a lambda but I think eventbridge is now the preferred way to do this sort of thing but from the documentation I cannot work out what is the right way to approach it.

I would like to trigger the same eventbridge rule for any error in any log group if this is possible as all the logs have the same format.

Is it possible to do this purely from cloudwatch log entries so I do not need to add additional code to my functions to call event bridge using the AWS api's?

Instead I would like to trigger the rule whenever a matching json object gets inserted into cloudwatch logs.

I was not even able to find the event structure for cloudwatch log updates.

berimbolo
  • 3,319
  • 8
  • 43
  • 78

1 Answers1

0

Amazon EventBridge is a serverless event bus for building event-driven applications. It is best suited for application to application integration with event filtering. Your use case seems to be of pure monitoring ( or notification)

For your use case (monitoring) using the metric filter will be the simple and elegant option.

For implementation (nodejs) refer :CloudWatch log multiple custom metric filters to trigger lambda function

Amit Meena
  • 2,884
  • 2
  • 21
  • 33
  • 1
    I actually went with a log subscriptions for this in the end, patterns that match trigger a lambda function which notifies via slack. – berimbolo Nov 08 '21 at 09:45
  • 1
    good to know that, maybe you can create and answer and publish the approach so others can be benefitted – Amit Meena Nov 08 '21 at 10:29