# Question about MQTT Log lines

**URL:** <https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440>\
**Category:** General\
**Created:** [6 January 2019 04:08 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440 "2019-01-06T04:08:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [6 January 2019 04:08 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/1 "2019-01-06T04:08:02Z")

</div>

I saw this issue a few months ago and promptly forgot about it.  
My log files are full of lines like the dump below. Can anyone suggest how I can determine why so many of my client devices are trying to reconnect?

```
sudo cat /var/log/mosquitto/mosquitto.log

1546338709: Client DVES_8674B8 already connected, closing old connection.
1546363026: Client ds18b20x2temperature already connected, closing old connection.
1546369779: Client ds18b20x2temperature already connected, closing old connection.
1546435361: Client temperature01temperature already connected, closing old connection.
1546539829: Client ds18b20x2temperature already connected, closing old connection.
1546615416: Client ds18b20x2temperature already connected, closing old connection.
1546660698: Client DVES_6936DF already connected, closing old connection.
1546696947: Client ds18b20x2temperature already connected, closing old connection.
1546739026: Client DVES_6936DF already connected, closing old connection.
1546739228: Client DVES_6936DF already connected, closing old connection.
1546739252: Client ESP8266Attic already connected, closing old connection.
1546739300: Client DVES_0416EC already connected, closing old connection.
1546739304: Client DVES_0680D2 already connected, closing old connection.
1546739452: Client DVES_AB4590 already connected, closing old connection.
1546739919: Client DVES_066D93 already connected, closing old connection.
1546739933: Client ESP8266Attic already connected, closing old connection.
1546740028: Client DVES_693697 already connected, closing old connection.
1546740498: Client mqtt_3571bf40.de007 already connected, closing old connection.
1546740627: Client DVES_8674B8 already connected, closing old connection.
1546740922: Client ds18b20x2temperature already connected, closing old connection.
1546740951: Client DVES_0416EC already connected, closing old connection.
1546741136: Client familyroomlight already connected, closing old connection.
1546741183: Client ds18b20x2temperature already connected, closing old connection.
1546741227: Client temperature01temperature already connected, closing old connection.
1546741334: Client DVES_0416EC already connected, closing old connection.
1546741400: Client DVES_557013 already connected, closing old connection.
1546742288: Client DVES_0416EC already connected, closing old connection.
1546742333: Client roomlight already connected, closing old connection.
1546742370: Client DVES_66AD29 already connected, closing old connection.
1546743583: Client DVES_6936DF already connected, closing old connection.
pi@Marvin:/var/log/mosquitto $
```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 January 2019 08:02 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/2 "2019-01-06T08:02:24Z")

</div>

> [@SteveMann](#):
>
> DVES\_8674B8 already connected, closing old connection

That suggests you have multiple mqtt config nodes with the same client id. Each config node must have a separate id (or must be blank in which case node-RED will autogenerate one.  
Have you removed lines from that log? The connecting event should also be there so you can check which ip address each one is on.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [6 January 2019 22:43 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/3 "2019-01-06T22:43:01Z")

</div>

This is interesting. I have another question on the forum regarding my config nodes ([Question about MQTT config nodes](https://discourse.nodered.org/t/question-about-mqtt-config-nodes/6439)), which may be the problem.

My MQTT broker is on a separate Pi, but according to the config tab, I have the broker defined multiple times. And I don't know why. Could this be causing the problem? (My client ID is always blank, but that's no guarantee that multiple config nodes could not auto-create the same client ID).

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 January 2019 00:25 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/4 "2019-01-07T00:25:50Z")

</div>

> [@SteveMann](#):
>
> My client ID is always blank, but that's no guarantee that multiple config nodes could not auto-create the same client ID

The nodes use their ID as part of the clientid, so there _is_ a guarantee that each generated client ID (within a single NR instance) will be unique.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 January 2019 08:02 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/5 "2019-01-07T08:02:50Z")

</div>

> [@SteveMann](#):
>
> My client ID is always blank

I am sorry, but I suspect that you are mistaken there. The log line

```auto
Client DVES_8674B8 already connected, closing old connection.

```

indicates that you have a node with that client id. Search for that id using the node-red search facility to check. Similarly with the other lines in the log. If you look at the mosquitto log (or whatever server you are using) you can check with machine is connecting with those ids.  
[Edit] That was a stupid thing to say, that is the mosquitto log. I would have expected to see the ip address there, perhaps that is controlled by a mosquitto config option.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 January 2019 08:07 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/6 "2019-01-07T08:07:40Z")

</div>

> [@Colin](#):
>
> indicates that you have a node with that client id.

Or a device outside of Node-RED entirely.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [7 January 2019 23:53 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/7 "2019-01-07T23:53:17Z")

</div>

Colin- when I said: "My client ID is always blank", I mean in the MQTT Config nodes in Node-Red.  
It would be nice if the IP of the node was in the log file, but it's loaded with "xyzzy already connected, closing old connection."

Heres the most recent:

```
1546177364: Client esp8266-5c:cf:7f:34:6f:56 already connected, closing old connection.
1546178129: Client ds18b20x2temperature already connected, closing old connection.
1546239929: Client temperature01temperature already connected, closing old connection.
1546318541: Client DVES_8674B8 already connected, closing old connection.
1546338709: Client DVES_8674B8 already connected, closing old connection.
1546363026: Client ds18b20x2temperature already connected, closing old connection.
1546369779: Client ds18b20x2temperature already connected, closing old connection.
1546435361: Client temperature01temperature already connected, closing old connection.
1546539829: Client ds18b20x2temperature already connected, closing old connection.
1546615416: Client ds18b20x2temperature already connected, closing old connection.
1546660698: Client DVES_6936DF already connected, closing old connection.
1546696947: Client ds18b20x2temperature already connected, closing old connection.
1546739026: Client DVES_6936DF already connected, closing old connection.
1546739228: Client DVES_6936DF already connected, closing old connection.
1546739252: Client ESP8266Attic already connected, closing old connection.
1546739300: Client DVES_0416EC already connected, closing old connection.
1546739304: Client DVES_0680D2 already connected, closing old connection.
1546739452: Client DVES_AB4590 already connected, closing old connection.
1546739919: Client DVES_066D93 already connected, closing old connection.
1546739933: Client ESP8266Attic already connected, closing old connection.
1546740028: Client DVES_693697 already connected, closing old connection.
1546740498: Client mqtt_3571bf40.de007 already connected, closing old connection.
1546740627: Client DVES_8674B8 already connected, closing old connection.
1546740922: Client ds18b20x2temperature already connected, closing old connection.
1546740951: Client DVES_0416EC already connected, closing old connection.
1546741136: Client familyroomlight already connected, closing old connection.
1546741183: Client ds18b20x2temperature already connected, closing old connection.
1546741227: Client temperature01temperature already connected, closing old connection.
1546741334: Client DVES_0416EC already connected, closing old connection.
1546741400: Client DVES_557013 already connected, closing old connection.
1546742288: Client DVES_0416EC already connected, closing old connection.
1546742333: Client roomlight already connected, closing old connection.
1546742370: Client DVES_66AD29 already connected, closing old connection.
1546743583: Client DVES_6936DF already connected, closing old connection.
1546789948: Client ds18b20x2temperature already connected, closing old connection.
1546794099: Client temperature01temperature already connected, closing old connection.
1546816124: Client DVES_8674B8 already connected, closing old connection.
1546878859: Client temperature01temperature already connected, closing old connection.
1546901109: Client temperature01temperature already connected, closing old connection.

```

Some of these I recognize, but the search in Home Assistant didn't help with those that I can't identify from the log. Do you mean "search flows" in the hamburger menu? Knolleary may be on to something because a couple of the devices I recognize are running Arduino code using the esphelper.h library. Most of my esp stuff have been switched to Tasmota, but there's a few that are still running my old code.

But, you have both given me something to research. The DVES lines are likely devices running Tasmota, but are you saying, Colin, that I have the same Client ID, like "DVES\_0416EC" used in two devices? I thought that Tasmota generated a random ID number, but if I change one character like "DVEX\_0416EC", then I should stop seeing it in the log files?

Thanks,  
Steve

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2019 09:28 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/8 "2019-01-08T09:28:14Z")

</div>

I should have recognised the DVES ids, they are, as you say, the default ids used by Tasmota. If you have not explicitly provided an id in Tasmota then the number after DVES should use the last 6 digits of the MAC address, so should be unique.  
If all your node-red brokers have blank client id then that suggests they are all from other devices. I think you need to find why your mosquitto log is lacking in detail, for example mine shows stuff like

```auto
1546881095: New connection from 192.168.xx.xx on port 1883.
1546881095: New client connected from 192.168.xx.xx as DVES_98974A (c1, k10).

```

The default mosquitto configuration file is `/etc/mosquitto/mosquitto.conf` and in addition any .conf files in `/etc/mosquitto/conf.d/` will be included. Have a look at those files and if you can't see anything obvious then post them here. I have checked mine and there doesn't seem to be anything that might make the logging more detailed, so perhaps yours has something that lowers the logging level.  
What version of mosquitto are you running? If on a Pi or other Debian based OS then run in a terminal  
`apt-cache policy mosquitto`  
and post the result here.

[Edit] I meant the default conf file for mosquitto is `/etc/mosquitto/mosquitto.conf`. I have editted the above text accordingly.  
Also corrected apt-cache policy command.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [8 January 2019 10:01 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/9 "2019-01-08T10:01:19Z")

</div>

Hi Colin,  
I think the path for the default log for mosquitto is...

/var/log/mosquitto/mosquitto.log

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2019 10:39 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/10 "2019-01-08T10:39:11Z")

</div>

> [@dynamicdave](#):
>
> I think the path for the default log for mosquitto is...  
> /var/log/mosquitto/mosquitto.log

Yes, sorry, I meant the default conf file, I have editted the earlier post to correct it.  
I have also corrected the apt-cache policy command which was wrong.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [8 January 2019 16:02 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/11 "2019-01-08T16:02:40Z")

</div>

Thanks for sticking with me here.  
_/etc/mosquitto/conf.d_ only contains the README file.

pi@Marvin:~ $ sudo apt-cache policy gnucash  
gnucash:  
Installed: (none)  
Candidate: 1:2.6.4-3  
Version table:  
1:2.6.4-3 0  
500 [http://mirrordirector.raspbian.org/raspbian/](http://mirrordirector.raspbian.org/raspbian/) jessie/main armhf Packages

My log files are full of "already connected, closing old connection." lines, and not one with "New Client..." or "New Connection...".

I would not be surprised that I have an older version of the Mosquitto broker- it's never received an upgrade since installing it early last year.

About upgrading Mosquitto:  
When I do a _sudo apt-get update -y_ on the Pi, I get this warning about Mosquitto:

```
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mosquitto.org jessie InRelease: The following signatures were invalid: KEYEXPIRED 151501 7477 KEYEXPIRED 1515017477 KEYEXPIRED 1515017477

W: Failed to fetch http://repo.mosquitto.org/debian/dists/jessie/InRelease

W: Failed to fetch http://repo.mosquitto.org/debian/dists/wheezy/main/binary-armhf/Packages 404 Not Found [IP: 85.119. 83.194 80]

W: Some index files failed to download. They have been ignored, or old ones used instead.

```

I don't know why it's trying to fetch wheezy files. This Pi is running Jessie:

```
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

```

I know I should be running Stretch, but the last time I tried upgrading Jessie to Stretch, it took me most of the day. I have a lot of flows on this Pi that I fear would break because they have nodes installed from NPM.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 January 2019 16:14 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/12 "2019-01-08T16:14:01Z")

</div>

check in your /etc/apt/sources.list or /etc/apt/sources.list.d directory so see if any file there contains wheezy. For things like mqtt it should just be a matter of editing it to say jessie , then re-run `sudo apt-get update && sudo apt-get upgrade` to get the newer versions.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2019 16:19 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/13 "2019-01-08T16:19:24Z")

</div>

> [@SteveMann](#):
>
> sudo apt-cache policy gnucash

I amended my post, that should have been  
`apt-cache policy mosquitto`  
also `/etc/mosquitto/mosquitto.conf` is the default config file, could you paste that here please.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2019 16:28 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/14 "2019-01-08T16:28:37Z")

</div>

The problem with the signature is that they changed the signing key. You need to

```auto
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key

```

However that is separate from the fact you seem to have something installed from wheezy, so follow @dceejay's advice to sort that out. That may not be mosquitto of course, the apt-cache policy command will tell you that.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [8 January 2019 16:47 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/15 "2019-01-08T16:47:06Z")

</div>

> [@dceejay](#):
>
> /etc/sources.list or /etc/sources.list.d directory

Thanks, but those files/folders don't exist here.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 January 2019 16:53 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/16 "2019-01-08T16:53:22Z")

</div>

sorry - I'm losing it.... /etc/apt/sources.list file and /etc/apt/sources.list.d dir

```
cd /etc/apt && grep -r wheezy

```

should show them

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [8 January 2019 17:23 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/17 "2019-01-08T17:23:35Z")

</div>

I was scratching my head over gnucache... 🤔

Here's policy mosquitto:

```
pi@Marvin:/etc $ apt-cache policy mosquitto
mosquitto:
  Installed: 1.4.14-0mosquitto1~nows1
  Candidate: 1.4.14-0mosquitto1~nows1
  Version table:
 *** 1.4.14-0mosquitto1~nows1 0
        500 http://repo.mosquitto.org/debian/ wheezy/main armhf Packages
        100 /var/lib/dpkg/status
     1.4.14-0mosquitto1~jessie2 0
        500 http://repo.mosquitto.org/debian/ jessie/main armhf Packages
     1.3.4-2+deb8u3 0
        500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages

```

And here is mosquitto.conf:

```
pi@Marvin:/etc $ sudo cat /etc/mosquitto/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 true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log
# You can choose which event types to log.
# By default error, information, notice and warning events are logged.
#
log_type error
log_type warning
#log_type notice
#log_type informaton

#For debugging, use:
#log_type all

include_dir /etc/mosquitto/conf.d

```

Hmm, maybe I need to change the log\_type.  
So, using log\_type all, I am getting a lot more data in the log file including IP addresses, so it will be easier to identify the problem nodes.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [8 January 2019 17:31 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/18 "2019-01-08T17:31:31Z")

</div>

Getting the new key fixed one of the warnings, but still getting this one:

`W: Failed to fetch http://repo.mosquitto.org/debian/dists/wheezy/main/binary-armhf/Packages 404 Not Found [IP: 85.119.83.194 80]`

Following dceejay's input:

```
pi@Marvin:~ $ cd /etc/apt && grep -r wheezy
sources.list.d/mosquitto-wheezy.list:deb http://repo.mosquitto.org/debian wheezy main
pi

```

This pointed me to the sources.list.d directory where I find:

```
-rw-r--r-- 1 root 49 May 3 2015 mosquitto-jessie.list
-rw-r--r-- 1 root 49 May 3 2015 mosquitto-wheezy.list
-rw-r--r-- 1 root 108 Nov 23 2017 nodesource.list
-rw-r--r-- 1 root 193 Mar 3 2017 raspi.list

```

Since this Pi is running Jessie, should the mosquitto.wheezy.list file even exist? Would it be safe to just delete it?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 January 2019 18:58 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/19 "2019-01-08T18:58:45Z")

</div>

Yes just delete it

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [8 January 2019 19:33 UTC](https://discourse.nodered.org/t/question-about-mqtt-log-lines/6440/20 "2019-01-08T19:33:13Z")

</div>

Thanks Colin and Cdeejay for your assistance. Also Knolleary, and you, too Dynamicdave.

Deleting the Wheezy line from sources.list.d fixed the Update/Upgrade warnings about Wheezy.  
Getting the latest signing key from [Mosquitto.org](http://Mosquitto.org) fixed the update warning about the Mosquitto key.  
Changing the **log\_type** in /etc/mosquitto/mosquitto.conf to: **log\_type all** now gives me more information to track down the original problem.

This thread has been very helpful, and I took copious notes. But since I've drifted from the original topic and you have given me much to research, unless either of you have additional information for me, I think this thread can be closed.

![Sig](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/dd9ad31cabf473d7d9d626da2b0c5c5eec6a56e3.jpeg)
