Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I delete/flush pm2 logs for only one app?

Tags:

pm2

Can I flush the logs of only one app in Pm2?

Assuming my app id is 2

I tried

pm2 flush 2

but still it flushes all apps' logs.

like image 854
Ali Elkhateeb Avatar asked Dec 14 '18 03:12

Ali Elkhateeb


People also ask

Can we delete pm2 logs?

pm2/pm2. log file that quickly caught up in size after the initial delete. If you want you can reboot after flushing pm2 logs. This method fixed the issue of the file still taking up space because it was used by all those processes.

Where are pm2 logs saved?

Access the logs By default, all logs are saved into $HOME/. pm2/logs .

How do I read pm2 logs?

Type pm2 log in a shell and you get an overview of the last 15 log lines and the last 15 error lines in realtime. At the top of these log lines, the location of your logfile is shown. You can also type pm2 log --lines 1000 to show more lines, in this case 1000. Show activity on this post.


2 Answers

It was a bug in pm2.

I submitted an issue and they fixed it.

To solve it on your side, run these commands:

$ npm install pm2@latest -g $ pm2 update 

And it should work with the latest release.

like image 76
Ali Elkhateeb Avatar answered Nov 08 '22 17:11

Ali Elkhateeb


You can flush log of specific app by mentioning name or id.

pm2 flush my_app_name // by name pm2 flush my_app_id   // by id 
like image 41
Haris Khurshid Avatar answered Nov 08 '22 18:11

Haris Khurshid