I’m using ostrio:logger (ostrio:logger - Packosphere) with the mongo adapter. I’d like to log the IP address of the accessing client on every log-entry. Is there a easy way to do this?
However, if you want the “real” ip behind a proxy you might need to set the HTTP_FORWARDED_COUNT env var.
Inside a method invocation in Meteor, you can access the connection details using this.connection. This gives you access to the connection that the method was received on. If the method is not associated with a connection, such as a server initiated method call, this.connection will be null. Calls to methods made from a server method which was in turn initiated from the client share the same connection.
Here is an example of how you can use this.connection:
In this example, this.connection will log the details of the connection that the method was received on.
Please note that this.connection is only available on the server. On the client, each connection has a different logged in user, so there is no global logged-in user state by definition.