I discussed here how to avoid ping messages in logs. By changing log_type(s) in mosquitto.conf I found that pings are reported under DEBUG LEVEL. I would comment this log type in the conf to avoid pings in log, but sadly PUBLISH entries are under the same log level and they are all relevant for me. So, I wonder if it is there any way to avoid exclusively pings from being logged.

Here is my mosquitto.conf:

# Place your local configuration in /etc/mosquitto/conf.d/
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

#persistence false
persistence true
persistence_location /var/lib/mosquitto/

#log_dest file /var/log/mosquitto/mosquitto.log
log_dest syslog

log_type error
log_type warning
log_type notice
log_type information
log_type debug
log_type subscribe
log_type unsubscribe
log_type websockets
#log_type all

connection_messages true
log_timestamp true

include_dir /etc/mosquitto/conf.d

2 Answers 2


No, not without editing the code to remove the log statements from the ping handling code and recompiling the broker.


I had the same requirement as you, so I have modified mosquitto v1.5.3 source code, and added a custom log_type in mosquitto.conf:

log_type ping

Source on Git Hub.

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.