I modified my /etc/mosquitto/mosquitto.conf to start on a different port and also require username password authentication. I then started my service like so:

 /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

I confirmed that all my devices and websites are able to connect and use this service in the way I expect, so everything is perfect.

I want to SSH into my server and enter the command line interface to visually monitor some activities . So I typed this command into bash mosquitto. But I get the following output:

605108095: mosquitto version 1.4.10 (build date 2020-06-13 20:47:29+0000) starting
1605108095: Using default config.
1605108095: Opening ipv4 listen socket on port 1883.
1605108095: Opening ipv6 listen socket on port 1883.

The message says I've logged into an instance of mosquitto that is running on port 1883. This NOT the instance I want to be monitoring. I want to monitor the instance that was initialized by /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf. How can I do that?

1 Answer 1


The mosquitto command is purely for starting an instance of the broker, running it again will not get you any information about an already running instance.

The default config installed normally pushes the logs to a file that is likely to be in /var/log/mosquitto if not it logs to stdout in the terminal you started it.

If you want to monitor messages being published then you need to use the mosquitto_sub command to act as a MQTT client. e.g.

mosquitto_sub -v -t '#'

This command will connect to a broker running on the same machine and subscribe to the wildcard topic of # (which gets everything).

You mentioned that you changed the port so you will need to add -p [portnumber] and if you need to add a username/password it's -u [username] -P [password]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.