2

I am currently using a PM2 ecosystem file ecosystem.config.js to start multiple Node.js apps using PM2.

module.exports = 
{
  "apps": [
    {
      "name": "foo",
      "script": "./foo.js",
    },
    {
      "name": "bar",
      "script": "./bar.js",
    },
    {
      "name": "baz",
      "script": "./baz.js",
    }
  ]
}

If we want to setup logrotate PM2 module to rotate my log files, instead of manually running the commands

pm2 set pm2-logrotate:max_size 1K 
pm2 set pm2-logrotate:compress true
pm2 set pm2-logrotate:rotateInterval '*/1 * * * *'

can the logrotate settings be configured using the ecosystem JS file?

Nyxynyx
  • 61,411
  • 155
  • 482
  • 830

1 Answers1

2

It is not possible. Based on pm2-logrotate author:

It's not possible apparently since pm2-logrotate is different than pm2, pm2 is not aware beforehand if pm2-lr is already installed or not.

Source: https://github.com/keymetrics/pm2-logrotate/issues/131

Sergio
  • 769
  • 1
  • 10
  • 15