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

Hi Wiebe,

Thanks for your reply.

At the moment I'm not using any authentication (just testing the solution).

I will check the usage of the plugin.

In the meantime, have you any idea why some rows of the log are not written in real time?
If this flaw can be solved easily, that would be enough for me.


Luca


On 12/09/2018 20:07, Wiebe Cazemier wrote:
----- Original Message -----
From: "Luca Tavanti" <luca.tavanti@xxxxxxxxxxxx>
To: mosquitto-dev@xxxxxxxxxxx
Sent: Wednesday, 12 September, 2018 16:01:35
Subject: [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

What is your authentication back-end? If you implement the mosquitto_plugin.h in C(++), you are free to program what you want. There is a function that is called to authorize clients upon first connection. You can log anything you want by writing the code for it.

The only issue is that you can't have two auth plugins, so you'd also have to write the code to replace whatever method you have now.
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev