ByteHouse (Cloud Data Warehouse Edition) supports streaming data via Kafka. This document describes how to consume log data from TLS into ByteHouse using the Kafka protocol.
Background information
TLS supports consuming log data from specified log topics via the Kafka protocol. For example, you can deliver log data to ByteHouse (cloud data warehouse edition), where it can be further analyzed and processed. After creating a Kafka data import task in ByteHouse, you can stream data directly via Kafka. The data import task will run automatically, continuously reading log data from the log topic and writing it into the specified database table.
When consuming logs, you can choose to consume only certain fields and configure settings such as the maximum message size. You can also stop the data import task at any time to reduce resource usage, and resume the task whenever necessary. ByteHouse will record the offset internally to ensure that no data is lost during stop and resume operations.
Billing description
When consuming logs via ByteHouse, TLS read traffic fees are incurred. It is recommended to use the private network service address to consume log data. For the corresponding internal network read traffic fees, please refer to Billing items and pricing. After logs are ingested into ByteHouse, storage fees will be incurred in ByteHouse. If real-time query and analysis are performed on the data, this will also incur computational costs. For detailed pricing, please refer to Billing overview. Prerequisites
- TLS has been enabled, a log project and log topic have been created, and log data has been successfully collected. For detailed instructions, please refer to Quick Start.
- The Kafka protocol consumption feature has been enabled for the specified log topic. For instructions on how to enable the Kafka consumption feature, refer to Enable the Kafka consumption feature.
- It is recommended to use an IAM account to perform operations. Before performing any operations, ensure that the currently logged-in account has permission to consume via the Kafka protocol, specifically the Action ConsumeLogs permission. For more details, refer to Authorized actions.
- ByteHouse (Cloud Data Warehouse Edition) has been activated. Please refer to Service activation for the operational steps.
Notes
When consuming logs through ByteHouse, the maximum log size that can be ingested into ByteHouse is 128KB. Log data that exceeds this limit cannot be successfully ingested into ByteHouse. This limitation is specified by the Max Block Size configuration of the data import task. The value range for this configuration is 65,536 to 131,072 bytes, that is, the maximum is 128KB.
Import logs into ByteHouse
The ByteHouse console provides both new and old versions of the data loading interface. This document uses the old data loading console interface as an example to demonstrate the steps for creating a new Kafka data source and a new data import task.
- In the upper left corner of the database page, click + New Database.
- Enter the basic information for the database.
- On the details page of the specified database, click the Data Table tab.
- Click + Data Table at the top right corner of the page.
- Select SQL or visual page creation.
- Set column names and data types in the SQL or visualization tab.
- You need to design a new table structure based on the source log structure in TLS. It is recommended to create only the columns that need to be saved or used for subsequent analysis.
- Create a Kafka data source.
- Click Data loading in the top navigation bar.
- Click Data Source at the top left corner of the page.
- On the data source page, click + Connect new source.
- Select Kafka as the data source type. data flow.
- Enter the basic information for the Kafka source.
- Create a data import task.
- Click Data loading in the top navigation bar.
- Click the + New data load button at the top-left corner of the page.
- Enter basic information.
- Define Schema mapping. Configure the field mapping between log data in TLS and table fields in ByteHouse. After specifying the mapping relationship, the designated fields in ByteHouse will be stored using the corresponding column names and data types.
tip
- If log data already exists in the log topic, you can directly click Parse to automatically parse the data.
- If the table structure does not meet your requirements, you can also click Edit target table to modify the structure of the target table.
- The source column name and data type of a field must exactly match those of the field in the source log data; otherwise, the field cannot be imported successfully.
- Set import task configuration.
- Click create. After a data import task is successfully created, it will automatically run and continuously stream log data from TLS using the Kafka protocol. If you need to pause an import task, you can click Stop in the upper right corner of the import task details page.
View import tasks
The Execution plan > Real-time data loading page displays the status information of all existing real-time data import tasks. Click the name of the import task to view detailed information.
Synchronization status descriptions
The synchronization status of data import tasks is explained as follows.
FAQs
Error indicating "unable to connect to Broker" occurs when creating a Kafka data source
- Problem description: When creating a new Kafka data source in Step 4, the page reports the error "kafka connectivity test failed, ping failed with err: kafka: client has run out of available brokers to talk to.......".
- Possible causes: The log topic has not enabled Kafka protocol consumption, or the Kafka broker list IP address, username, and password are incorrect.
- Refer to the operation steps to correctly fill in the relevant parameters. For instructions on the operation steps, see operation steps.