A Message Queue for Apache Kafka instance can be connected to Filebeat as an output. This topic shows you how to send messages to Message Queue for Apache Kafka over the Internet by using Filebeat.
Prerequisites
- A Message Queue for Apache Kafka instance is purchased and deployed. For more information, see Access from the Internet and VPC.
- Filebeat is downloaded and installed. For more information, see Download Filebeat.
- Java Development Kit (JDK) 8 is downloaded and installed. For more information, see Download JDK 8.
Step 1: Obtain an endpoint
Filebeat establishes a connection to Message Queue for Apache Kafka by using a Message Queue for Apache Kafka endpoint.
Step 2: Create a topic
Perform the following operations to create a topic for storing messages:
Step 3: Use Filebeat to send a message
Start Filebeat on the server where Filebeat is installed to send a message to the topic that you created.
Step 4: View the partitions of the topic
Perform the following operations to view the message that was sent to the topic:
Step 5: Query the message by offset
You can query the sent message based on its partition ID and offset information.
- Log on to the Message Queue for Apache Kafka console.
- In the left-side navigation pane, click Instances.
- On the Instances page, click the name of your instance.
- In the left-side navigation pane, click Message Query.
- On the Message Query page, click the Query by Offset tab.
- Enter the topic of the sent message in the Enter a topic. search box, select the partition ID of this message from the Select a partition. drop-down list, and then enter the offset of this message in the Enter an offset. search box. Then, click Search.
- Optional:On the right side of the query result, you can view the message details.