# Logs topics Mosquitto under Docker

**URL:** <https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439>\
**Category:** Broker management and monitoring\
**Created:** [January 18, 2022, 9:48am UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439 "2022-01-18T09:48:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel-WW](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@Daniel-WW](https://forum.cedalo.com/u/Daniel-WW)\
**Post date:** [January 18, 2022, 9:48am UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439/1 "2022-01-18T09:48:30Z")

</div>

Hello,  
im running Mosqitto under Docker by using docker-compose file on a NAS-System. The MQTT-Broker works in a small Smart-Home-Environment with a few temperature-sensors.

Now I’m trying to expose the topics of these sensors by the Mosquitto logs, but I don’t know where to find. I use a logs-file, but it seems, that find the specific topics in that.

I use the following conf-settings:

```auto
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
log_dest stdout
log_dest topic
log_type all
listener 1883

```

I would be glad if someone could help me where to find the logs.  
Do I have to enter in the mosquitto-container by terminal? Could you explain me how to achieve that?

Thanks a lot for your help in advance an best regards - Daniel

---

<div class="post-metadata">

**Author:** ![roger.light](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@roger.light](https://forum.cedalo.com/u/roger.light)\
**Post date:** [January 18, 2022, 2:07pm UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439/2 "2022-01-18T14:07:21Z")

</div>

Hi Daniel,

If I understand what you’re asking, I’m afraid it isn’t possible within mosquitto directly. I think you want to print the messages received on your topics to /mosquitto/log/mosquitto.log, is that right?

The `log_dest topic` config option is used to send the output of the mosquitto logs to an MQTT topic rather than the other way round.

You could log the topics you are interested in by running a separate client, for example `mosquitto_sub -t <your-topic> -v > /your/log/file`.

When you start the container you can specify that local directories are mapped into the container:

```auto
docker run <your options> -v <absolute-path-to-log-directory>:/mosquitto/log eclipse-mosquitto

```

That means you can then view the logs on your local machine without having to enter the container.

Regards,

Roger

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@Daniel-WW](https://forum.cedalo.com/u/Daniel-WW)\
**Post date:** [January 18, 2022, 3:41pm UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439/3 "2022-01-18T15:41:24Z")

</div>

Hello Roger,  
thanks for your quick response. Im a verry newbie in MQTT-Stuff and I’m just doing my first steps. So sorry for my missunderstanding. 😉 I wana try to explain, what I’m searching for.:

I already store the logs in a log file.  
I have a small Smart-Home-Setup, with three temperature sonsors, which use mosquitto as MQTT-Broker.  
By using node-RED i wana try to store the MQTT-Data from Mosqitto to an influx Database. To achieve this, I need to know the name of the certain topics, which are used by the temperature sensors.  
Acutally I do not know how the topic is called, which node-RED should look for.

Maybe you or someone else could help me to solve the beginner-question. 😉

I found a [tutorial](https://www.youtube.com/watch?v=ffg3_1AgtyA&t=1688s) that shows how to find the topics on a raspberry-pi.  
But I don’t know how to do this by using docker.

Thanks and Regardst - Daniel

---

<div class="post-metadata">

**Author:** ![roger.light](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@roger.light](https://forum.cedalo.com/u/roger.light)\
**Post date:** [January 18, 2022, 5:18pm UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439/4 "2022-01-18T17:18:18Z")

</div>

Right, I understand now. In this case I would use a client that subscribes to the `#` topic, which means it will see everything being published by any client, and so you can find the topics you are interested in.

One way to do this is with mosquitto\_sub:

```auto
mosquitto_sub -h <ip of your broker> -t '#' -v

```

Or

```auto
docker run -it eclipse-mosquitto mosquitto_sub -h <ip of your broker> -t '#' -v

```

Or you could use a graphical client like MQTT Explorer: [http://mqtt-explorer.com/](http://mqtt-explorer.com/)

Regards,

Roger

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@Daniel-WW](https://forum.cedalo.com/u/Daniel-WW)\
**Post date:** [January 21, 2022, 8:59am UTC](https://forum.cedalo.com/t/logs-topics-mosquitto-under-docker/439/5 "2022-01-21T08:59:36Z")

</div>

Hi, thanks a lot for your advice.  
I tried the graphical client and especially in the beginning this helped me a lot to understand in a visual manner how MQTT works. I could find out the topics, which I was searching for. In my case my little [temperature-sensors](https://www.zigbee2mqtt.io/devices/WSDCGQ11LM.html#xiaomi-wsdcgq11lm) does not even use single-value-topics, but also multiple-value as json. So I followed again [this tutorial](https://www.youtube.com/watch?v=ffg3_1AgtyA&t=1688s) to understand how to deal with the data in Node-RED. On this way I’m now able to write the data in my influxDB. Thanks for your help.  
Best Regards - Daniel
