All Products
Search
Document Center

EventBridge:Route events to Log Service

Last Updated:Mar 11, 2026

When you build event-driven architectures, you often need to persist events for querying, analysis, or compliance auditing. EventBridge event rules filter events on a custom event bus and route them to one or more targets. By routing events to Simple Log Service (SLS), you can store, query, and monitor events in a Logstore without building a custom ingestion pipeline.

Prerequisites

Before you begin, make sure that you have:

Step 1: Create a custom event source

A custom event source registers your application as an event producer on a custom event bus.

  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. Click the name of the custom event bus that you want to use.

  4. In the left-side navigation pane, click Event Sources, then click Add Event Source.

  5. In the Add Custom Event Source panel, configure the following parameters:

    ParameterDescription
    NameA name for the event source
    Description(Optional) A description of the event source
    Event ProviderSelect Custom Application
  6. Click OK.

Step 2: Create an event rule with a Log Service target

An event rule filters events by pattern and delivers matching events to one or more targets. This step creates a rule that routes events to your Logstore.

Important

Event targets must reside in the same region as the event rule.

  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. Click the name of the event bus that you want to use.

  4. In the left-side navigation pane, click Event Rules, then click Create Rule.

  5. In the Create Rule panel, complete the following steps:

Configure basic info

Set Name and Description, then click Next Step.

Configure an event pattern

  1. Set Event Source Type to Custom Event Source.

  2. From the Event Source drop-down list, select the event source created in Step 1.

  3. In the Pattern Content code editor, specify an event pattern. For syntax details, see Event patterns.

  4. Click Next Step.

Configure targets

Note

Each event rule supports up to five event targets.

  1. Set Service Type to Log Service.

  2. Configure the target parameters:

    ParameterDescription
    Log ProjectSelect the Log Service project you created
    LogstoreSelect the Logstore you created
    Log TopicEnter a custom log topic to categorize events in the Logstore
    Log ContentSelect the content to route. For details, see Event transformation
    RoleSelect the RAM role that authorizes EventBridge to write to Log Service. See RAM role permission policy
  3. Click Create.

RAM role permission policy

The RAM role requires the log:PostLogStoreLogs permission on the target Logstore. The following policy grants the minimum required access:

{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "log:PostLogStoreLogs"
      ],
      "Resource": [
        "acs:log:*:*:project/<Project name>/logstore/<Logstore name>"
      ]
    }
  ]
}

Replace the placeholders with your actual values:

PlaceholderDescriptionExample
<Project name>Log Service project namemy-eventbridge-project
<Logstore name>Logstore namemy-eventbridge-logstore

To create and assign policies, see Policies.

Step 3: Publish a test event

Publish a test event to verify that the routing rule works. The EventBridge console supports publishing events to custom event buses only.

  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. Find your event bus and click Publish Event in the Operations column.

  5. In the Publish Event to Custom Event Bus panel, select a custom event source from the Custom Event Source drop-down list.

  6. In the Event Body code editor, enter the event content. For details about event fields, see Event overview.

  7. Click OK.

Verify the result

After publishing an event, confirm that it arrived in the Logstore:

  1. Log on to the Log Service console.

  2. In the Projects section, click your project name.

  3. On the Logstores page, click the Logstore name.

  4. Click Search & Analyze to query the delivered events.

Query analysis

If the event was routed successfully, the query results display entries that match the event payload published in Step 3.