---
schema_version: "1"
id: 45a2da7f2ce6b22e21d4c4b3838b03751b7d6127809bfaa8540acf2a640c7df0
title: Create an EventBridge Rule for Logging Events in a CloudWatch Log
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/ev_relay_verify_connection.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.ev_relay_verify_connection.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5e39c907f9cba8164a093676382c849a706d9856a06618830ed0256cac05ed14
description: To test the connection between Salesforce and AWS and ensure that the event messages are received in EventBridge, add a CloudWatch log as a target of a rule. Incoming event messages from Salesforce are logged in CloudWatch.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Create an EventBridge Rule for Logging Events in a CloudWatch Log

To test the connection between Salesforce and AWS and ensure that the event messages are received in EventBridge, add a CloudWatch log as a target of a rule. Incoming event messages from Salesforce are logged in CloudWatch.

For more information, see [Amazon EventBridge rules](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rules.html) and [Amazon EventBridge targets](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-targets.html) in the AWS documentation.

1. In Amazon Eventbridge, click **Rules**.
2. Select your event bus from the dropdown. The name of the event bus is the same as the name of the partner event source that you queried earlier. It’s in this format: `aws.partner/salesforce.com/orgID/channelID`
3. In the Rules section, click **Create rule**.
4. Provide a name for your rule.
5. Click **Next**.
6. Under Event source, select **AWS events or EventBridge partner events**.
7. Skip the Sample event section. In Event pattern, for Event source, select **EventBridge partners**.
    1. From the partner dropdown, select **Salesforce**.
    2. For Event type, select **All Events**. The event pattern box autopopulates to this value.
        
        ```
        {
          "source": [{
            "prefix": "aws.partner/salesforce.com"
          }]
        }
        ```
8. The rule matches incoming events based on the defined pattern. If you want to add a filter to match a specific platform event, match events whose `detail-type` field contains the API name of the platform event, for example, `Carbon_Comparison__e`. For more information about event pattern matching, see [Content filtering in Amazon EventBridge event patterns](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html) in the AWS documentation.
    1. Under Event pattern, click **Custom patterns (JSON editor)**.
    2. In the input box, In Define pattern, select **Custom pattern**, and replace the pattern with this pattern.
        
        ```
        {
          "source": [{
            "prefix": "aws.partner/salesforce.com"
          }],
          "detail-type": ["Carbon_Comparison__e"]
        }
        ```
9. Click **Next**.
10. Under Target 1, Target types, select **AWS service**.
11. Under Select a target, select **CloudWatch log group**.
12. Complete the log group path. For example: `/aws/events/mygroup/log`.
13. Click **Next** and then **Next**.
14. Review the rule that you created, and then click **Create rule**.

After creating the rule and the Cloudwatch log, verify receiving events in [Verify Receiving Events in CloudWatch](https://help.salesforce.com/s/articleView?id=platform.ev_relay_test_receiving_events.htm&release=264.0.0&type=5 "Verify that events sent from Salesforce are received in EventBridge using a CloudWatch log.").