From e19f78ce4e212ddf764c98b23c8578d1f42ed425 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Thu, 6 Feb 2020 22:29:07 +0100 Subject: [PATCH] MQTT: update docs (#16152) --- filebeat/docs/filebeat-options.asciidoc | 3 + filebeat/docs/inputs/input-mqtt.asciidoc | 81 ++++++++++++++++++++++++ filebeat/input/mqtt/config.go | 4 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 filebeat/docs/inputs/input-mqtt.asciidoc diff --git a/filebeat/docs/filebeat-options.asciidoc b/filebeat/docs/filebeat-options.asciidoc index dd4f0ec999e..40a04e7e4b1 100644 --- a/filebeat/docs/filebeat-options.asciidoc +++ b/filebeat/docs/filebeat-options.asciidoc @@ -51,6 +51,7 @@ You can configure {beatname_uc} to use the following inputs: * <<{beatname_lc}-input-docker>> * <<{beatname_lc}-input-tcp>> * <<{beatname_lc}-input-syslog>> +* <<{beatname_lc}-input-mqtt>> * <<{beatname_lc}-input-s3>> * <<{beatname_lc}-input-netflow>> * <<{beatname_lc}-input-google-pubsub>> @@ -74,6 +75,8 @@ include::inputs/input-tcp.asciidoc[] include::inputs/input-syslog.asciidoc[] +include::inputs/input-mqtt.asciidoc[] + include::../../x-pack/filebeat/docs/inputs/input-aws-s3.asciidoc[] include::../../x-pack/filebeat/docs/inputs/input-netflow.asciidoc[] diff --git a/filebeat/docs/inputs/input-mqtt.asciidoc b/filebeat/docs/inputs/input-mqtt.asciidoc new file mode 100644 index 00000000000..563682abf3c --- /dev/null +++ b/filebeat/docs/inputs/input-mqtt.asciidoc @@ -0,0 +1,81 @@ +:type: mqtt + +[id="{beatname_lc}-input-{type}"] +=== MQTT input + +++++ +MQTT +++++ + +Use the `MQTT` input to read data transmitted using lightweight messaging protocol +for small and mobile devices, optimized for high-latency or unreliable networks. + +This input connects to the MQTT broker, subscribes to selected topics and parses data +into common message lines. Everything happens before line filtering, multiline, and JSON decoding, +so this input can be used in combination with those settings. + +Example configuration: + +["source","yaml",subs="attributes"] +---- +{beatname_lc}.inputs: +- type: mqtt + hosts: <1> + - tcp://broker:1883 + - ssl://secure_broker:8883 + topics: <2> + - sample_topic +---- + +<1> `hosts` are required. + +<2> `paths` are required. + +All other settings are optional. + +==== Configuration options + +The `mqtt` input supports the following configuration options plus the +<<{beatname_lc}-input-{type}-common-options>> described later. + +===== `hosts` + +A list of MQTT brokers to connect to. + +===== `topics` + +A list of topics to subscribe to and read from. + +===== `qos` + +An agreement level between the sender of a message and the receiver of a message that defines the guarantee of delivery. + +There are 3 QoS levels in MQTT: + +* At most once (`0`), +* At least once (`1`), +* Exactly once (`2`). + +===== `client_id` + +A unique identifier of each MQTT client connecting to a MQTT broker. + +===== `username` + +A client username used for authentication provided on the application level by the MQTT protocol. + +===== `password` + +A client password used for authentication provided on the application level by the MQTT protocol. + +===== `ssl` + +Configuration options for SSL parameters like the certificate, key and the certificate authorities +to use. + +See <> for more information. + +[id="{beatname_lc}-input-{type}-common-options"] +include::../inputs/input-common-options.asciidoc[] + +:type!: diff --git a/filebeat/input/mqtt/config.go b/filebeat/input/mqtt/config.go index 1f9c2817055..219ea0137c5 100644 --- a/filebeat/input/mqtt/config.go +++ b/filebeat/input/mqtt/config.go @@ -28,8 +28,8 @@ type mqttInputConfig struct { Topics []string `config:"topics" validate:"required,min=1"` QoS int `config:"qos" validate:"nonzero,min=0,max=2"` - ClientID string `config:"clientID" validate:"nonzero"` - Username string `config:"user"` + ClientID string `config:"client_id" validate:"nonzero"` + Username string `config:"username"` Password string `config:"password"` TLS *tlscommon.Config `config:"ssl"`