New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide ability to log client port when logging new connections #1911
Milestone
Comments
ralight
added a commit
that referenced
this issue
Dec 1, 2020
Closes #1911. Thanks to twegener-embertec.
This will be part of 2.0. |
fAuernigg
pushed a commit
to fAuernigg/mosquitto
that referenced
this issue
Jan 4, 2021
Closes eclipse#1911. Thanks to twegener-embertec.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently, on new connections, mosquitto logs the IP address and the server port.
However, when the client connections arrive from the local host (e.g. if using a load balancer in front of multiple mosquitto instances), the connections address information is indistinguishable, e.g.:
It would be useful to be able to log the client port as well, so as to be able to distinguish these connections, and marry them up to log entries in the load balancer. It seems like this would be useful for diagnostics in general, in conjunction with e.g. netstat.
It would also be useful to have the client port logged in the "New bridge connected from" message as well, so as to marry up the client ID to the unique incoming address.
It seems like this should be not too hard.
src/net.c net__socket_get_address could be modified to also extract the client port from the getpeername result, and store that in a second buffer, which context__init could then put into a client_port field in the mosquitto context struct.
Then that could (optionally?) be logged upon new connections.
The text was updated successfully, but these errors were encountered: