Logs problem with cluster mode with pm2

System Information
  • Strapi Version: 4.23.0
  • Operating System: Ubuntu 22.04.4 LTS
  • Database: postgresql
  • Node Version: v20.12.2
  • NPM Version: 10.5.0
  • Yarn Version: 1.22.22

I have a problem with pm2, when I put it in a cluster mode with strapi, the logs do not appear correctly (logs of request or crashes), no log enters error or out, it only enters a file called pm2.log

ecosystem.config.js

module.exports = {
  apps: [
    {
      name: "x-strapi",
      cwd: "/var/www/api",
      script: "yarn",
      time: true,
      log_date_format: "YYYY-MM-DD HH:mm Z",
      args: "start",
      increment_var: "PORT",
      env: {
    PORT: 1337,
        NODE_ENV: "production",
      },
      out_file: "./logs/out.log",
      error_file: "./logs/error.log",
      instances : "max",
      exec_mode : "cluster",
      merge_logs: true,
    },
  ],
};

This topic has been created from a Discord post (1230979947099852901) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

1 Like