- Main Tool: A new C++ tool to log MQTT messages to syslog and optionally the terminal, replacing the limited
mqtt-data-logger
python script. It compiles without syslog support if only logging to a file or terminal. - Features: Logs each message on a separate thread in a thread pool for speed (thousands of messages per second with enough system resources). Handles connection failures with automatic reconnect.
- Source and Downloads: On github. A ready-made docker image is here. Licensed under GNU AGPLv3.
- Building: Written in C++ 17 with CMake. Requires
Paho MQTT C++ library
andsyslog.h
. On Ubuntu/Debian, installlibpaho-mqttpp-dev
,libpaho-mqtt-dev
,build-essential
, andgit
. Clone or download the repository and use CMake to compile. - Usage: Configurable with command line options or environment variables. Command line args include broker URL, topic, username, password, syslog facility, and more. Environment variables are also available. Examples given for basic usage and viewing logs.
- rsyslog and logrotate: Configure rsyslog to save logs to
/var/log/mqtt_msgs.log
. Uselogrotate
to not delete these logs. - Docker: Build and run with
docker build -t mqtt-logger.
anddocker run --env BROKER=test.mosquitto.org mqtt_logger
. Or use the provideddocker-compose.yml
file.
In summary, this is a cross-platform tool for logging MQTT messages with various configuration options and easy deployment using Docker.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。