This topic describes how to configure the data import feature of Alibaba Cloud Simple Log Service (SLS) to synchronize data from Azure Event Hubs in real time. This solution uses the Kafka protocol compatibility of SLS to pull data from an Event Hub to a specified logstore over a secure SASL_SSL connection. This process enables centralized storage and analysis of cross-cloud data.
This is an original document from Alibaba Cloud, and Alibaba Cloud owns all intellectual property rights. This document describes how Alibaba Cloud services integrate with third-party products and may mention the names of third-party companies or their products.
Preparations
Alibaba Cloud resources:
If you use an Alibaba Cloud account, it has all permissions by default. If you use a RAM user, ensure that the RAM user is granted the
AliyunLogFullAccesspermission. For granular access control, see Create a custom policy.
Azure resources:
Create an Event Hub instance on the Azure platform and retrieve the following configuration information. This information is required to configure the SLS data import job.
Event Hub namespace name: This is used to form the endpoint for the SLS connection.
Event Hub instance name: This is equivalent to a Kafka topic and serves as the data source for the import.
Connection string: The credential used for identity verification. This string is used as the password in the SLS import configuration.
For more information about how to create resources and retrieve the preceding information on Microsoft Azure, see the official Azure documentation: Quickstart: Create an event hub using Azure portal.
Procedure
Step 1: Create an SLS data import job
Log on to the Simple Log Service console.
Click the name of the project.
In the navigation pane on the left, click
Job Management, and then click the Data Import tab.Click Create Data Import Job. On the Kafka - Data Import card, click Integrate Now.
Select the destination logstore for the data import and click Next.
On the Import Configuration page, enter the following information:
Display Name: The display name of the job.
Endpoint: Enter the Kafka endpoint of Azure Event Hubs. The format is
<EventHub namespace name>.servicebus.windows.net:9093.Topics: Enter the name of the Event Hub instance.
Starting Position: Select the starting point for the data import.
Earliest: Start importing data from the earliest available message in the topic. This is suitable for scenarios that require a full synchronization of historical data.
Latest: Start importing new data generated after the job starts. This is suitable for incremental synchronization scenarios.
Data Format: Select the format of the source logs. This example uses JSON String. The import job parses the data into key-value pairs, but only parses the first layer.
Encoding Format: The encoding format of the data to be imported. Select UTF-8.
:
protocol: Select sasl_ssl.
mechanism: Select PLAIN.
username: Enter
$ConnectionString. The Event Hubs Kafka endpoint requires this value as the username for SASL PLAIN authentication.password: Enter the connection string that you retrieved from the Event Hub namespace.
Click Preview and check whether the fields in the preview data are as expected.
If the preview fails, check the endpoint, topic, and authentication information against the error message.
After you confirm that the preview data is as expected, click Next.
Step 2: Configure indexes
Configure indexes for the imported log data to enable efficient queries and analysis. On the Query and Analysis Configurations page:
By default, the full-text index is enabled, which lets you search for keywords in the original log content.
To perform term queries based on fields, click Automatic Index Generation after the Preview Data is loaded. SLS then generates a field index based on the first entry in the preview data.
Click Next to complete the data import configuration.
Step 3: View and manage the import job
After the job is created, it starts automatically and runs continuously.
In the navigation pane on the left, click
Job Management.Click the Data Import tab. Click the name of the target job to open the job overview page. On this page, view detailed monitoring metrics, such as job status, processing speed, and error messages.
Billing
The fees for the SLS data import feature vary based on the billing mode:
Pay-by-ingested-data: The cost is calculated based on the volume of written raw logs. For more information, see Billable items for the pay-by-ingested-data mode.
Pay-by-feature: Fees are calculated based on factors such as read and write traffic, the number of read and write requests, index traffic if you enable indexing, and storage space. For more information about billing, see Billable items of pay-by-feature.