The Mosquitto Add-on adds a timestamp to each log entry:
1588009094: mosquitto version 1.6.3 starting
1588009094: Config loaded from /etc/mosquitto.conf.
1588009094: Loading plugin: /usr/share/mosquitto/auth-plug.so
1588009094: |-- *** auth-plug: startup
1588009094: ├── Username/password checking enabled.
1588009094: ├── TLS-PSK checking enabled.
1588009094: └── Extended authentication not enabled.
1588009094: Opening ipv4 listen socket on port 1883.
1588009094: Opening ipv6 listen socket on port 1883.
1588009094: Opening websockets listen socket on port 1884.
I want to change that timestamp into a date and time.
According to the mosquitto’s documentation, all that’s needed is to add this line to the mosquitto.conf
file:
log_timestamp_format %Y-%m-%dT%H:%M:%S
However, I’ve had no success implementing it with the Mosquitto Addon.
I found an instance of mosquitto.conf
here:
/usr/share/hassio/addons/core/mosquitto/data
but any changes made to that instance are not read by mosquitto on restart (or at least not for me).
I proceeded to follow the instructions provided by the Mosquitto addon. I changed active:
from false
to true
:
customize:
active: true
folder: mosquitto
then created the following directory:
/usr/share/hassio/share/mosquitto
and added mosquitto.conf
to it, containing just that one line shown above. My thinking was that its contents would be appended to the base mosquitto.conf
file.
After restarting the mosquitto addon, there was no change to the log’s timestamp. In fact, the log contained no reference to using my “appended” copy of the config file. It didn’t use it as a substitute for the base config file either.
How does one go about adding options to the base mosquitto.conf
file?
NOTE
According to the log, it reads the mosquitto.conf
file from /etc
1588009094: Config loaded from /etc/mosquitto.conf.
but Portainer shows that there’s no mapping for /etc
so it implies it is reading /etc/mosquitto.conf
from within the container itself (meaning any changes to it will not survive a restart). If that’s true then it doesn’t bode well for my desire to modify it.