mqtt-logger is an utility for logging several MQTT messages flows for several topics and brokers into a single logfile.
Install Docker CE and Docker Compose on your host
git clone https://github.com/campusiot/mqtt-logger.git mqtt-logger
cd mqtt-logger
docker build -f Dockerfile -t campusiot/mqtt-logger:latest .
mkdir -p ~/configuration/mqtt-logger/
mkdir -p ~/data/mqtt-logger/
cp settings.CAMPUSIOT_MQTTS.json ~/configuration/mqtt-logger/settings.json
(cd ~/configuration/mqtt-logger ; wget https://raw.githubusercontent.com/CampusIoT/campusiot-certs/master/mqtt/ca.crt)
touch ~/data/mqtt-logger/msg.log
# Edit topic, username and password
vi ~/configuration/mqtt-logger/settings.json
docker run -d \
-v ~/configuration/mqtt-logger/settings.json:/usr/src/app/settings.json:ro \
-v ~/configuration/mqtt-logger/ca.crt:/usr/src/app/ca.crt:ro \
-v ~/data/mqtt-logger/:/data/ \
--name mqtt-logger campusiot/mqtt-logger:latest
tailf ~/data/mqtt-logger/msg.log