elastic/Machinebeat

How to get the mqtt message topic?

Closed this issue · 1 comments

I'm using machinebeat to monitore some devices, but I need the mqtt topic where the message came from. When I see the generated document on elastic, it shows me this message:
"event": { "module": "mqtt", "creation": "2022-12-06T14:08:01.020Z", "dataset": "mqtt.topic", "provider": "mqtt", "url": "tcps://localhost:8883", "duration": 628392 },

Is there any way to get the message topic?

One option is to activate legacy fields:
legacyFields: true

There is also the fully supported Filebeat MQTT module available now, which I would recommend to use if you only plan to collect MQTT data: https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-mqtt.html