Reputation: 2244
Is it possible to log MQTT Broker Mosquitto events such as messages published to all channels, subscriptions, client connections/disconnections and errors to a log file with a time stamp and then have program insert this into a database either SQL in encrypted form?
If so, how could this be achieved?
What I have tried?
I have subscribed to the topic $SYS/broker/# ,able to get only connection logs,My query here is how can i get what message is sent and received from broker?
Reference Link : http://www.steves-internet-guide.com/mosquitto-logging/
Upvotes: 1
Views: 7369
Reputation: 510
You can add all or a subset of the following entries to the mosquitto.conf
file to enable various logging levels and add a timestamp:
log_dest stdout
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
log_timestamp_format [%H:%M:%S]
This will redirect all Mosquitto logging to stdout
, which you can then either pipe into a custom program that ingests it and persists to a database or redirect the output to a file and later process it.
Upvotes: 1