All Products
Search
Document Center

EventBridge:Route events to Log Service

Last Updated:Jun 20, 2026

You can use an event rule to filter events and route them to Log Service. This topic uses a custom event as an example to describe the prerequisites, procedure, and how to verify the results.

Prerequisites

Step 1: Add a custom event source

  1. Log on to the EventBridge console. In the left navigation pane, click Event Buses.
  2. In the top navigation bar, select a region. On the Event Buses page, click the target custom event bus.
  3. In the left navigation pane, click Event Sources, and then click Add Event Source.
  4. In the Add Custom Event Source panel, enter a Name and Description. For Event Provider, select Event Provider, and then click OK.

Step 2: Create an event rule

Important The event target and the event rule must be in the same region.
  1. Log on to the EventBridge console. In the left-side navigation pane, click Event Buses.

  2. In the top navigation bar, select a region. On the Event Buses page, click the name of the event bus that you want to manage.

  3. In the left-side navigation pane, click Event Rules. On the page that appears, click Create Rule.

  4. In the Create Rule panel, complete the following steps, and then click Create.
    1. On the Configure Basic Info tab, enter a Name and Description for the event rule, and then click Next.
    2. On the Configure Event Pattern tab, set Event Source Type to Custom Event Sources. For Event Sources, select the custom event source that you created in Step 1: Add a custom event source. In the Pattern Content code box, enter an event pattern, and then click Next.

      For more information, see Event patterns.

    3. On the Configure Targets tab, for Service Type, select Simple Log Service, and then configure the following parameters.
      Note You can add up to five event targets for an event rule.
      • Project: Select the log project that you created.
      • Logstores: Select the logstore that you created.
      • Topic: Enter a custom log topic.
      • Content: The log content to be routed. For more information, see Event transformation.
      • Role: Authorize EventBridge to use this role to post logs to Log Service. The role must be granted the permissions specified in the following policy. For more information, see Permission policies and examples.
        {
          "Version":"1",
          "Statement":[
            {
              "Effect":"Allow",
              "Action":[
                "log:PostLogStoreLogs"
              ],
              "Resource":[
                "acs:log:*:*:project//logstore/"
              ]
            }
          ]
        }

Step 3: Publish an event

  1. Log on to the EventBridge console.

  2. In the left-side navigation pane, click Event Buses.

  3. In the top navigation bar, select a region.

  4. On the Event Buses page, find the target event bus and click Publish Event in the Operations column.

    Note

    The EventBridge console supports publishing events to custom event buses only.

  5. In the Publish Event To Custom Event Bus panel, configure the following settings:

    SettingDescription
    Custom Event SourceSelect an existing custom event source from the drop-down list.
    Event BodyEnter the event content.
  6. Click OK.

Verify the results

  1. Log on to the Log Service console.
  2. In the Projects section, click your target project.
  3. On the Logstores page, click the target logstore.
  4. Click Search & Analyze to view the query and analysis results.
    The query result shows that Total Logs is 1 and Query Status is Accurate. On the Raw Logs tab, you can find a JSON-formatted log record related to EventBridge. Its content field contains event attributes such as name (EventBridge), number (100), type (ui:Created:PostObject), and specversion (1.0). This confirms that the event was successfully delivered to Log Service.