From 64457697ff8adbada451a7b89d3db9ab164bc061 Mon Sep 17 00:00:00 2001 From: Lynette Miles Date: Wed, 18 Jun 2025 15:28:15 -0700 Subject: [PATCH 1/2] Pipeline: inputs: mqtt: style Signed-off-by: Lynette Miles --- pipeline/inputs/mqtt.md | 37 ++++++++++++++++++------------ vale-styles/FluentBit/Acronyms.yml | 1 + 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/pipeline/inputs/mqtt.md b/pipeline/inputs/mqtt.md index 9d67bdbea..ac5739f8f 100644 --- a/pipeline/inputs/mqtt.md +++ b/pipeline/inputs/mqtt.md @@ -1,28 +1,35 @@ # MQTT -The **MQTT** input plugin, allows to retrieve messages/data from MQTT control packets over a TCP connection. The incoming data to receive _must_ be a JSON map. +The _MQTT_ input plugin retrieves messages and data from MQTT control packets over a TCP connection. The incoming data to receive must be a JSON map. -## Configuration Parameters +## Configuration parameters The plugin supports the following configuration parameters: | Key | Description | Default | | :---------- | :------------------------------------------------------------- | :------ | -| Listen | Listener network interface. | `0.0.0.0` | -| Port | TCP port where listening for connections. | `1883` | -| Payload_Key | Specify the key where the payload key/value will be preserved. | _none_ | -| Threaded | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` | +| `Listen` | Listener network interface. | `0.0.0.0` | +| `Port` | TCP port where listening for connections. | `1883` | +| `Payload_Key` | Specify the key where the payload key/value will be preserved. | _none_ | +| `Threaded` | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` | -## Getting Started +## Get started -In order to start listening for MQTT messages, you can run the plugin from the command line or through the configuration file: +To listen for MQTT messages, you can run the plugin from the command line or through the configuration file. -### Command Line +### Command line -Since the **MQTT** input plugin let Fluent Bit behave as a server, we need to dispatch some messages using some MQTT client, in the following example _mosquitto_ tool is being used for the purpose: +The MQTT input plugin lets Fluent Bit behave as a server. Dispatch some messages using a MQTT client. In the following example `mosquitto` tool is being used for the purpose: + +Running the following command: ```bash -$ fluent-bit -i mqtt -t data -o stdout -m '*' +fluent-bit -i mqtt -t data -o stdout -m '*' +``` + +Returns a response like the following: + +```text Fluent Bit v1.x.x * Copyright (C) 2019-2020 The Fluent Bit Authors * Copyright (C) 2015-2018 Treasure Data @@ -33,15 +40,15 @@ Fluent Bit v1.x.x [0] data: [1463775773, {"topic"=>"some/topic", "key1"=>123, "key2"=>456}] ``` -The following command line will send a message to the **MQTT** input plugin: +The following command line will send a message to the MQTT input plugin: ```bash -$ mosquitto_pub -m '{"key1": 123, "key2": 456}' -t some/topic +mosquitto_pub -m '{"key1": 123, "key2": 456}' -t some/topic ``` -### Configuration File +### Configuration file -In your main configuration file append the following _Input_ & _Output_ sections: +In your main configuration file append the following `Input` and `Output` sections: ```python [INPUT] diff --git a/vale-styles/FluentBit/Acronyms.yml b/vale-styles/FluentBit/Acronyms.yml index 9ff67b6bd..86e4d7e1c 100644 --- a/vale-styles/FluentBit/Acronyms.yml +++ b/vale-styles/FluentBit/Acronyms.yml @@ -52,6 +52,7 @@ exceptions: - LLDB - LLVM - LTS + - MQTT - NET - NOTE - NVDA From 05a706d49e3d36f8229489eb5b2fbac3c185c75e Mon Sep 17 00:00:00 2001 From: Lynette Miles <6818907+esmerel@users.noreply.github.com> Date: Fri, 20 Jun 2025 08:44:21 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Craig Norris <112565517+cnorris-cs@users.noreply.github.com> Signed-off-by: Lynette Miles <6818907+esmerel@users.noreply.github.com> --- pipeline/inputs/mqtt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/inputs/mqtt.md b/pipeline/inputs/mqtt.md index ac5739f8f..d046d765d 100644 --- a/pipeline/inputs/mqtt.md +++ b/pipeline/inputs/mqtt.md @@ -19,7 +19,7 @@ To listen for MQTT messages, you can run the plugin from the command line or thr ### Command line -The MQTT input plugin lets Fluent Bit behave as a server. Dispatch some messages using a MQTT client. In the following example `mosquitto` tool is being used for the purpose: +The MQTT input plugin lets Fluent Bit behave as a server. Dispatch some messages using a MQTT client. In the following example, the `mosquitto` tool is being used for the purpose: Running the following command: