Disk usage by Mosquitto logs

Hello everyone, especially @cicoub13 and @pierre-gilles,

I received an alert on my Gladys instance (mini-PC) because disk space was low.
Investigating, it’s caused by a container.

image

This container corresponds to eclipse-mosquitto, used by the Zigbee2MQTT service or by MQTT, I’m not certain.
This is confirmed by the info file at the source of this folder:

Digging a little further, restarting the container changed nothing. In fact, it’s a single file that’s using all the space:

/var/lib/docker/containers/9991e6bed47295b41c61b190cfb4168c0a2fe282b561e4afa950ceb8a2dbf781/9991e6bed47295b41c61b190cfb4168c0a2fe282b561e4afa950ceb8a2dbf781-json.log

This log file uses 24 GB!

Here’s an excerpt:

{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.13707785Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.650861947Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.650892565Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-372063 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.650919128Z\"}
{\"log\":\"1668743198: Sending PUBLISH to NodeRed-6dda341ee7a029cb (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.650951475Z\"}
{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651049516Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (135 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651070441Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (135 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651075885Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-372063 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (135 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651112656Z\"}
{\"log\":\"1668743198: Sending PUBLISH to NodeRed-6dda341ee7a029cb (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (135 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651137601Z\"}
{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (135 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651298518Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r1, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651313521Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651318495Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-372063 (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651322586Z\"}
{\"log\":\"1668743198: Sending PUBLISH to NodeRed-6dda341ee7a029cb (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651328966Z\"}
{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (35 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.651354167Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693765258Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693813636Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-372063 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693829505Z\"}
{\"log\":\"1668743198: Sending PUBLISH to NodeRed-6dda341ee7a029cb (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.69383429Z\"}
{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (283 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693881662Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (127 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693935993Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (127 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693942686Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-372063 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (127 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.693996451Z\"}
{\"log\":\"1668743198: Sending PUBLISH to NodeRed-6dda341ee7a029cb (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (127 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.694010852Z\"}
{\"log\":\"1668743198: Sending PUBLISH to mqttjs_85adae46 (d0, q0, r0, m0, 'zigbee2mqtt/bridge/logging', ... (127 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.694042749Z\"}
{\"log\":\"1668743198: Received PUBLISH from mqttjs_85adae46 (d0, q0, r1, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (27 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.694107082Z\"}
{\"log\":\"1668743198: Sending PUBLISH to gladys-main-instance-362751 (d0, q0, r0, m0, 'zigbee2mqtt/capteurQualitéDeLair', ... (27 bytes))\\n\",\"stream\":\"stderr\",\"time\":\"2022-11-18T03:46:38.694133106Z\"}

Fix to consider?

Since this is probably a « bug », we should force the « emptying » of this file every day during Gladus backup, for example.

Thanks for the alert.
We could reduce the log_type to retain only warnings/errors.
I don’t see an option to reduce log retention, so the cleanup would have to be developed by us :neutral_face:

On the Raspberry image I set a default setting in the Docker config

I suggest you modify your Docker config, delete the log and restart the Docker daemon.

3 Likes

Indeed the option "–log-opt max-size=10m \" is missing in the docker run of the MQTT integration (and maybe Zigbee2mqtt too), as we do with the Gladys container ( Installation avec Docker | Gladys Assistant )

It needs to be added, it’s a problem I agree!

Issue created:

2 Likes

I’ve made an initial fix for MQTT:

2 Likes

Thanks @AlexTrovato for the PR, I tested it and it works fine on my side, I’ve merged :folded_hands:

FYI, existing containers will be automatically restarted with the correct parameter on the next Gladys update, and this will automatically clear the existing logs.

2 Likes

@pierre-gilles I did the same for Zigbee, but I can’t test this one because it requires a Zigbee key to create the containers.

1 Like

Can you create a Docker image? I’ll run the test.

You’ll find the image name in the PR description on GitHub ;)\nIt should have been generated since then.

2 Likes

Thanks @AlexTrovato! I’m waiting for feedback from @cicoub13 on the functional part

Would you like a Zigbee USB dongle, @AlexTrovato?

Hi,
For development it’s true that it would be easier if I had a dongle and at least one sensor, especially since I’m considering other changes, like being able to connect to a remote z2m.
And that will lighten Vonox; he’ll be able to retrieve his environment for himself :wink:

2 Likes

Or how to allow controlling two houses remotely in this case!

1 Like

It was spare @AlexTrovato don’t worry

I can send you a Zigbee2MQTT key; I have

So great, the remote Z2M :star_struck:

Thanks @Tlse-vins! :folded_hands: Shall I let you sort out the key between you?

Regarding the devices, would you like one or several devices @AlexT

Ahah great, we’ll call her Mrs. Claus!! :heart:

I think an actuator like a smart plug and a temperature sensor (or multi-sensor) would make a good starter kit.
But if we have an idea for more complex integrations, it could be a good opportunity.

@AlexTrovato I suggest this for the plug:

https://www.domadoo.fr/fr/peripheriques/6165-nous-prise-intelligente-zigbee-30-mesure-de-consommation-5907772033517.html?domid=17

That way you’ll have the consumption measurement

For a temperature/humidity sensor, everything is out of stock at the moment; I had seen this one but it’s not available before the end of February:

https://www.domadoo.fr/fr/peripheriques/6197-nous-capteur-de-temperature-et-humidite-zigbee-30-tuya-5907772033890.html?domid=17

Otherwise I found a somewhat « fun » product that makes testing easy since you can click on it:

https://www.domadoo.fr/fr/peripheriques/5684-woox-telecommande-intelligente-4-boutons-zigbee-30-8435606701136.html?domid=17

I don’t think we support it either, so it could be nice :slight_smile:

Otherwise you can look at this search if you see something useful: Domadoo sale — Zigbee sensors in stock :wink:

These sockets return a value every minute, or even more frequently depending on consumption. Also useful for getting continuous readings.

It’s a CC2652R ZZh that I have, if you want me to send it to you, give me your address in a private message.

That one is awesome!