How to see message MQTT properties when using mosquitto_sub command

1.1k Views Asked by At

I'm running Mosquitto command mosquitto_sub to subscribe to a topic and see the messages published there.

I would like to be able to see the MQTT properties used when someone publishes a message in that topic.

Is there any way?

Thanks

1

There are 1 best solutions below

0
On

You can use the format option (-F) that takes a pattern, for example:

mosquitto_sub -t <topic> -V mqttv5 -F %C

In the example above we are printing the Content type property (%C).

Don't forget the version option (-V) using mqttv5.

You can find more printable properties here: https://mosquitto.org/man/mosquitto_sub-1.html#outputformat (see MQTT related parameters)