Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

MongoDB captures public IP in log, any way to capture private IP in log?

[initandlisten] connection accepted from 48.29.16.208:5307 #48 (2 connections now open)it capture 
public ip in log

anyways to capture private ip in log
eg: [initandlisten] connection accepted from 192.168.0.76:5307 #48 (2 connections now open)

Hi,

The mongod server only reports the client’s IP address depending on which interface it binds to in the server. It cannot know anything about any client that the client doesn’t present to the server.

If you want to capture the private IP of the client, the mongod server first needs to bind to a local IP address (e.g. 192.168.0.xxx). However this would also make the server only accessible from that private network, which is something that you may or may not want.

Best regards,
Kevin