Message Queue for Apache Kafka can be connected to Filebeat as an output. This topic describes how to use Filebeat to send messages to Message Queue for Apache Kafka in a virtual private cloud (VPC) environment.
Prerequisites
- A Message Queue for Apache Kafka instance is purchased and deployed. For more information, see Access from a 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 has been installed to send a message to the topic you created.
- Run the cd command to switch to the installation directory of Filebeat.
- Create the output.conf configuration file.
- Send a message to the topic you created.
- Run the
./filebeat -c ./output.yml
command. - Enter test and then press Enter.
- Run the
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.