[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] get the connection events of clients

Dear all,

I'm trying to obtain information about the status of clients as they connect and disconnect, in order to track their status. I my deployment I have a restricted and known set of clients.
I'm working on the server, so I have full access to the broker.


I would like to build this information automatically, without having the client send their status or last will (as I found it is often suggested on the web).

It seems to me that one possible way could be to enable "connection_messages" in the config and then parse the log.
However, when trying it, I discovered that the line which I'm most interested in (which contains the clientID), is not written to the log in real time.
For example:
1535990985: New connection from 213.188.207.137 on port 8844.
1535990985: New client connected from 213.188.207.137 as sys-a1b2c3 (c1, k60).
1535991025: Client sys-a1b2c3 disconnected.


The second line is generally flushed together with the third (or with any successive event that is logged).
It is therefore very difficult to have a complete overview of the status of all clients in real time.


Can you suggest me a workaround for this issue?
is there a way to force mosquitto to print the "New client connected from 213.188.207.137 as sys-a1b2c3 (c1, k60)" line in real time?


Alternatively, are you aware of a different method to get the real-time status of all clients (or the list of currently connected clients)?

Thanks in advance!

Luca