When I ran pm2 flush <app_id> pm2 flushed all the logs for all 10 apps I have.
PM2 REPORT (Fri Dec 14 2018 10:11:38 GMT+0000 (UTC))
--- Daemon -------------------------------------------------
pm2d version : 3.1.2
node version : 9.4.0
node path : /usr/local/bin/pm2
argv : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 3min
--- CLI ----------------------------------------------------
local pm2 : 3.1.2
node version : 9.4.0
node path : /usr/local/bin/pm2
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : root
uid : 0
gid : 0
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU @ 2.50GHz
cpus nb : 2
freemem : 1115119616
totalmem : 7864020992
home : /root
published
$ npm install pm2@latest -g
$ pm2 update
Hi, I am on pm2 version 3.3.1, and now when I run pm2 flush <app_id> it doesn't even flush any of the apps.
I am on 4.2.1 and still doesn't delete logs.
pm2 flush
4.4.0
su - gitlab-runner -c "pm2 flush 5"
now working
4.4.1:
$ pm2 ls
โโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโ
โ id โ name โ mode โ โบ โ status โ cpu โ memory โ
โโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโค
โ 0 โ main โ fork โ 3 โ stopped โ 0% โ 0b โ
โโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโ
$ pm2 flush 0
[PM2] Logs flushed # !!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ pm2 flush main # OK
[PM2] Flushing:
[PM2] /home/fedora/.pm2/logs/main-out.log
[PM2] /home/fedora/.pm2/logs/main-error.log
[PM2] Logs flushed
More information:
$ node -v
v12.18.3
$ npm -v
6.14.8
$ cat /etc/os-release
NAME=Fedora
VERSION="31 (Cloud Edition)"
#...
this is either not fixed, or the fix fell out of later versions! I was on 4.4.0 and it doesn't work, updated to 4.5.0 and it still doesn't work! The only thing that DOES work is "pm2 flush" which of course flushes out (empties) logs for ALL running pm2 apps.
Most helpful comment
I am on 4.2.1 and still doesn't delete logs. does not work
pm2 flush