Skip to content
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

Closed
twegener-embertec opened this issue Nov 26, 2020 · 1 comment
Closed
Milestone

Comments

@twegener-embertec
Copy link

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.:

1606281410: New connection from 127.0.0.1 on port 8884.

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.

ralight added a commit that referenced this issue Dec 1, 2020
Closes #1911. Thanks to twegener-embertec.
@ralight
Copy link
Contributor

ralight commented Dec 2, 2020

This will be part of 2.0.

@ralight ralight added this to the 2.0 milestone Dec 2, 2020
@ralight ralight closed this as completed Dec 2, 2020
fAuernigg pushed a commit to fAuernigg/mosquitto that referenced this issue Jan 4, 2021
Closes eclipse#1911. Thanks to twegener-embertec.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants