Skip to content

Commit

Permalink
MQTT: update docs (#16152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtojek committed Feb 6, 2020
1 parent 8f522be commit e19f78c
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 2 deletions.
3 changes: 3 additions & 0 deletions filebeat/docs/filebeat-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand All @@ -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[]
Expand Down
81 changes: 81 additions & 0 deletions filebeat/docs/inputs/input-mqtt.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
:type: mqtt

[id="{beatname_lc}-input-{type}"]
=== MQTT input

++++
<titleabbrev>MQTT</titleabbrev>
++++

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 <<configuration-ssl>> for more information.

[id="{beatname_lc}-input-{type}-common-options"]
include::../inputs/input-common-options.asciidoc[]

:type!:
4 changes: 2 additions & 2 deletions filebeat/input/mqtt/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit e19f78c

Please sign in to comment.