Pm2: [BUG] pm2 flush <app_id> flushes all the logs

Created on 14 Dec 2018  ยท  6Comments  ยท  Source: Unitech/pm2

What's going wrong?

When I ran pm2 flush <app_id> pm2 flushed all the logs for all 10 apps I have.

Supporting information

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

Pending Release Bug

Most helpful comment

I am on 4.2.1 and still doesn't delete logs.
pm2 flush does not work

All 6 comments

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 does not work

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rangercyh picture rangercyh  ยท  4Comments

xzycn picture xzycn  ยท  3Comments

alexpts picture alexpts  ยท  3Comments

mario-mui picture mario-mui  ยท  3Comments

ldarren picture ldarren  ยท  3Comments