DEV Community

Cover image for Detect EventBridge target failure: Part 2 - using enhanced monitoring
Pubudu Jayawardana for AWS Community Builders

Posted on • Originally published at pubudu.dev

Detect EventBridge target failure: Part 2 - using enhanced monitoring

Intro

When delivering messages to different targets using EventBridge, it is important to get notified if there are any delivery failures. EventBridge doesn’t provide this out of the box, but there are several ways to achieve this.

In the 1st part of this blog we discussed how we can get notified when a delivery fails to a target using a dead letter queue.

In this blog post we will discuss another (better?) option to achieve the same using EventBridge enhanced logging.

EventBridge Enhanced Logging

On 15th July 2025 AWS introduced enhanced logging for EventBridge. Which means now you can enable logging and EvenBridge will send those logs into a configured log delivery location.

Available log destinations are:

  • S3
  • CloudWatch logs
  • Amazon Data Firehose stream

Also you can configure the standard log levels as required: Trace, Info and Errors.

You can select more than one log destination and for each destination, you can select the same or a different log level. This is really useful, for example, I can use S3 to log all the traces while using CloudWatch log stream to log only errors.

How it works

In this example, I have used EventBridge enhanced logging to log any errors occurring into a CloudWatch log stream.

Architecture
Image: Architecture

Simply, EventBridge will log any errors into the CloudWatch log. Once the log record is available in the CloudWatch log stream, there are multiple ways to trigger a CloudWatch alarm. In this example, I use the number of incoming log events as the metric to trigger the alarm.

If you use a CloudWatch log stream with log level trace (which includes info and errors as well) and still you want to trigger an alarm based on any error occurring, you may use an option like creating a metric filter in the log group.

Try this yourself

I have created a Github repository with a AWS SAM template for you to test this scenario in your AWS account.

  1. Clone the Github repository: https://github.com/pubudusj/event-bridge-target-failure-detection-with-enhanced-logging

  2. Deploy the stack using below command:

    sam deploy \
    --template-file template.yaml \
    --stack-name eb-fail-detection-with-enhanced-logging \
    --capabilities CAPABILITY_IAM \
    --no-confirm-changeset \
    --parameter-overrides NotificationEmail=[YourEmailAddress]
    
  3. Here, add your email address as NotificationEmail, so you will get the notification into your email box when the target fails.

  4. Once the stack is deployed, you will get a SNS subscription confirmation email. You need to confirm it in order to receive notifications.

  5. Then, publish a message into the created event bus with the source as xyzcorp.

  6. This way the message will match the rule and try to deliver the message to the target.

  7. I have blocked the permission for publishing the target intentionally to simulate the failure.

  8. In a moment, you should get an email with the alarms status.

  9. If you go to the CloudWatch log stream created, you can see the entry with log level ERROR and message type INVOCATION_FAILURE.

Please note:
As of now, creating the enhanced logging and delivering them to a delivery destination is not a straight forward configuration. You need to create a CloudWatch log group, a delivery source, a delivery destination and a logs delivery.

Refer: https://github.com/pubudusj/event-bridge-target-failure-detection-with-enhanced-logging/blob/main/template.yaml#L31-L59

Which means if you need to send these enhanced logs to multiple destinations, you need to repeat configuring those resources per destination.

However, nice thing about this approach is that you only need to configure this only once on the event bus, and it will log the whole message life cycle within EventBridge systems including ingestion as well as deliveries to all the targets.

Summary

  1. Overall, enhanced logging is a great improvement to EventBridge because up until now, message delivery was a black box (for customers), specially the consumer side of EventBridge. With this new addition, you can track and debug the flow of your message within EventBridge systems transparently using the logs generated in each and every step that the message is going through, from ingest to delivery (of course depends on the log level that was configured).

  2. Also, you can configure more than one log destinations as well as different log levels.

  3. Since creating single log delivery using CloudFormation requires several AWS resources to be configured, I hope EventBridge team will provide easy to use method to configure this, ideally as properties of EventBridge Bus.

Resources

  1. Monitor and debug event-driven applications with new Amazon EventBridge logging: https://aws.amazon.com/blogs/aws/monitor-and-debug-event-driven-applications-with-new-amazon-eventbridge-logging/

👋 I regularly create content on AWS and Serverless, and if you're interested, feel free to follow/connect with me so you don't miss out on my latest posts!

LinkedIn: https://www.linkedin.com/in/pubudusj
Twitter/X: https://x.com/pubudusj
Medium: https://medium.com/@pubudusj
Personal blog: https://pubudu.dev

Top comments (0)