Alibaba Cloud EventBridge Best Practices¶
This article explains how to integrate the content of Alibaba Cloud EventBridge into the Guance platform, leveraging Guance's powerful unified aggregation capabilities to easily obtain Alibaba Cloud events and track the latest data information in real time.
Background Information¶
EventBridge is a serverless event bus service provided by Alibaba Cloud. It supports standardized and centralized access for Alibaba Cloud services, custom applications, and SaaS applications, enabling these applications to route events using the standard CloudEvents 1.0 protocol. This helps you easily build loosely coupled, distributed event-driven architectures. However, for multi-cloud environments or even traditional IDC + cloud service hybrid architectures, customers prefer to consolidate cloud events, metrics, logs, traces, etc., for comprehensive orchestration. The Guance platform provides this capability.
Prerequisites¶
You have completed the following operations:
- Installed DataKit; for detailed steps, refer to <Host DataKit Installation>
- Enabled Alibaba Cloud EventBridge (currently free during public beta)
- Allowed port 9529 in the server security group
Use Cases¶
Push event information through EventBridge's built-in HTTP service to Guance.
Step One: Modify DataKit Listening Port¶
- Edit the main DataKit configuration file
/usr/local/datakit/conf.d/datakit.conf
on your server:
- Restart DataKit:
Step Two: Create an EventBridge Rule¶
-
Log in to the Alibaba Cloud EventBridge Console
-
Select "EventBus" - "default" - "Event Rules"
- Create a rule, configure basic information, enter a name and description, then click "Next"
- Configure the event pattern, select "Alibaba Cloud Official Event Source," choose the desired "Event Source" and "Event Type"
- After selection, you can test the event pattern, then click "Next"
- Configure the event target, set "Service Type" to
HTTP
, "URL" toDataKit Logging API Address
, and "Body" toTemplate
-
When "Body" is set to
Template
, define the variables and custom template as per Alibaba Cloud Template Documentation -
Variables: Extract parameters from the original cloud event data using JSONPath with "$."
- Template: Reference variables using "${}" and ensure the format complies with the DataKit API Specification
- Set "Network Type" to
Public Network
, then click "Confirm"
-
Log in to Guance, navigate to the "Logs" module to view the generated events
-
measurement: Data source
- message: Log content
- fields: Extended fields
Data Validation¶
- Event Tracking > Event Details, view the original cloud event data
- Event Tracking > Event Trace, verify if the event was delivered successfully
- Check data reception status on the server at
/var/log/datakit/gin.log