bithavoc / express-winston

express.js middleware for winstonjs
https://www.npmjs.com/package/express-winston
MIT License
798 stars 186 forks source link

IP address in msg format string #89

Closed zacg closed 9 years ago

zacg commented 9 years ago

Is there a way to include the clients ip address in the msg format string?

floatingLomas commented 9 years ago

Not tested, but if you're using a proxy:

{{ req.headers['x-forwarded-for'] || req.connection.remoteAddress }}

If you're not using a proxy:

{{ req.connection.remoteAddress }}
zacg commented 9 years ago

Thanks that works.