Skip to content

Only rotates logs for one process of a cluster #194

Open
@MorayM

Description

@MorayM

I have cluster running 3 instances of a process using the following ecosystem file:

module.exports = {
  apps: [{
    name: 'api.my_product.com',
    script: './dist/src/index.js',
    instances: 3,
    exec_mode: 'cluster',
    autorestart: true,
    watch: false,
    max_memory_restart: '2G',
    env: {
      NODE_ENV: 'production',
    },
  }],
};

Which writes logs to the default location ~/.pm2/logs.

I've installed pm2-logrotate with the default settings, however it only rotates the logs for the first process in the cluster. The other two processes continue writing to the same files. How do I configure it to rotate log files for all the processes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions