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.
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region. Click the name of the custom event bus that you want to use.
In the left-side navigation pane, click Event Sources, then click Add Event Source.
In the Add Custom Event Source panel, configure the following parameters:
Parameter Description Name A name for the event source Description (Optional) A description of the event source Event Provider Select Custom Application 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.
Event targets must reside in the same region as the event rule.
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region. Click the name of the event bus that you want to use.
In the left-side navigation pane, click Event Rules, then click Create Rule.
In the Create Rule panel, complete the following steps:
Configure basic info
Set Name and Description, then click Next Step.
Configure an event pattern
Set Event Source Type to Custom Event Source.
From the Event Source drop-down list, select the event source created in Step 1.
In the Pattern Content code editor, specify an event pattern. For syntax details, see Event patterns.
Click Next Step.
Configure targets
Each event rule supports up to five event targets.
Set Service Type to Log Service.
Configure the target parameters:
Parameter Description Log Project Select the Log Service project you created Logstore Select the Logstore you created Log Topic Enter a custom log topic to categorize events in the Logstore Log Content Select the content to route. For details, see Event transformation Role Select the RAM role that authorizes EventBridge to write to Log Service. See RAM role permission policy 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:
| Placeholder | Description | Example |
|---|---|---|
<Project name> | Log Service project name | my-eventbridge-project |
<Logstore name> | Logstore name | my-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.
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region.
Find your event bus and click Publish Event in the Operations column.
In the Publish Event to Custom Event Bus panel, select a custom event source from the Custom Event Source drop-down list.
In the Event Body code editor, enter the event content. For details about event fields, see Event overview.
Click OK.
Verify the result
After publishing an event, confirm that it arrived in the Logstore:
Log on to the Log Service console.
In the Projects section, click your project name.
On the Logstores page, click the Logstore name.
Click Search & Analyze to query the delivered events.

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