I was wondering if there was a way to centralize pm2 logs by either sending them to elastic search or integrating pm2 with the ELK stack in some way.
I would suggest you to use a pm2 module which would send logs to logstash using PM2's pm2.launchBus(errback) api (http://pm2.keymetrics.io/docs/usage/pm2-api/).
As you can see here https://github.com/cliv/pm2-gelf/blob/master/app.js#L24 It's pretty straight forward. The module listens pm2's log events and sends logs using gelf protocol in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With