This topic describes how to create an event stream whose event provider is Simple Log Service in the EventBridge console.
Before you start
Background information
Simple Log Service is a cloud-native observability and analytics platform that provides large-scale, low-cost, and real-time services to process multiple types of data such as logs, metrics, and traces. Simple Log Service is a one-stop platform that helps improve your digital capabilities in R&D, O&M, and data security. It allows you to collect, transform, query, analyze, consume, and deliver data in a visualized manner. You can also configure alerts in the Simple Log Service console. EventBridge allows you to obtain events from Simple Log Service in real time and load the events to event targets. This helps you efficiently respond to various business and operation events.
Procedure
Log on to the EventBridge console. In the left-side navigation pane, click Event Streams.
In the top navigation bar, select a region and click Create Event Stream.
On the Create Event Stream page, configure the Task Name and Description parameters and follow the on-screen instructions to configure other parameters. Then, click Save. The following section describes the parameters:
Task Creation
In the Source step, set the Data Provider parameter to Simple Log Service and follow the on-screen instructions to configure other parameters. Then, click Next Step. The following table describes the parameters.
Parameter
Description
Example
Project
Select the Simple Log Service project that you created.
test-Project
Logstore
Select the Simple Log Service Logstore that you created.
test-LogStore
Consumer Offset
Specify the offset from which messages are consumed. Valid values: Earliest Offset, Latest Offset, and Specified Time.
Latest Offset
Role
Specify the role that EventBridge assumes to read logs in Simple Log Service. For information about the policies of the role, see Create a custom event source of the Log Service type.
testRole
Messages
The maximum number of messages that can be sent in each function invocation. Requests are sent only when the number of messages in the backlog reaches the specified value. Valid values: 1 to 10000.
100
Interval (Unit: Seconds)
The time interval at which you want to invoke the function. The system sends the aggregated messages to Function Compute at the specified time interval. Valid values: 0 to 15. Unit: seconds. The value 0 indicates that messages are immediately sent after aggregation.
3
In the Filtering, Transformation, and Sink steps, configure the event filtering method, event transformation rule, and event target. For information about event transformation configurations, see Use Function Compute to perform message cleansing.
Task Property
Configure the retry policy and dead-letter queue for the event stream. For more information, see Retry policies and dead-letter queues.
Go back to the Event Streams page and find the event stream that you created. Then, click Enable in the Actions column.
Enabling an event stream requires 30 to 60 seconds to complete. You can view the progress in the Status column of the event stream on the Event Streams page.
Sample event
{
"datacontenttype": "application/json;charset=utf-8",
"aliyunaccountid": "175299981560****",
"data": {
"key1": "value1",
"key2": "value2",
"__topic__": "test_topic",
"__source__": "test_source",
"__client_ip__": "122.231.XX.XX",
"__receive_time__": "1663487595",
"__pack_id__": "59b662b2257796****"
},
"subject": "acs:log:cn-qingdao:175299981560****:project/qiingdaoproject/logstore/qingdao-logstore-1",
"aliyunoriginalaccountid": "175299981560****",
"source": "test-SLS",
"type": "sls:connector",
"aliyunpublishtime": "2022-09-18T07:53:15.387Z",
"specversion": "1.0",
"aliyuneventbusname": "qingdaoBus",
"id": "qiingdaoproject-qingdao-logstore-1-1-MTY2MzExODM5ODY4NjAxOTQyMw****",
"time": "2022-09-18T07:53:12Z",
"aliyunregionid": "cn-qingdao",
"aliyunpublishaddr": "10.50.XX.XX"
}
For information about the parameters defined in the CloudEvents specification, see Overview.
The following table describes the parameters contained in data. The parameters that are prefixed and suffixed with underscores (_) are the system fields of Simple Log Service. For more information, see Reserved fields.
Parameter | Type | Example | Description |
key1 | String | testKey | The field in the log of the user. |
__topic__ | String | testTopic | The log topic. |
__source__ | String | testSource | The device from which the log is collected. |
__client_ip__ | String | 122.231.XX.XX | The IP address of the host where the log resides. |
__receive_time__ | String | 1663487595 | The time when the log arrives at the server. |
__pack_id__ | String | 59b662b2257796**** | The unique ID of the log group to which the log belongs. |