I am trying to run my node application across all CPUs that I have. The command i am using is
pm2 start index.js -i max --output logdir/access.log --error logdir/error.log
the problem with this is it creates 2 files in logdir a.k.a "access.log" and "error.log".
when i run pm2 with specified number of instances, example:
pm2 start index.js -i 8 --output logdir/access.log --error logdir/error.log
it creates separate log files for each instance. example "access-0.log", "access-1.log", "error-0.log", "error-1.log" and so on.
My question is how do I get this separate log files when I run pm2 for all instances.
Thanks in advance.
this should work the way you want
pm2 start index.js -i $(nproc --all) --output logdir/access.log --error logdir/error.log