Pm2 log issues

The file got huge, couldnt open it to see what was in there. I overwrote it to watch it fill up again but now it’s not showing anything, yet my disk continues to fill up. I see several GB worth of stuff in /home/asterisk/.pm2 but cant actually get to it from the cli. Can I just delete that directory without breaking anything?

‘tail -f filename.ext’ will open it for reading and send the read stream to the console.

‘tail -100 filename.ext’ will print the last 100 lines. Buffering is minimal in both cases

Thanks. I see a bunch of these, and then it stopped about the time i overwrote the file.

2022-08-29T15:14:46: PM2 log: App [restapps:19] starting in -fork mode-
2022-08-29T15:14:46: PM2 log: App [restapps:19] online
2022-08-29T15:22:24: PM2 log: Stopping app:restapps id:19
2022-08-29T15:22:24: PM2 log: App [restapps:19] exited with code [0] via signal [SIGINT]

Can I just overwrite this file too?

you would best ‘truncate’ it, not overwrite it, it’s a file handle thing.

I’ve been using echo -n > filename , might be saying the same thing here

1 Like

Another option is truncate. truncate -s0 empties the file, but truncate -s just shortens (or extends) it.

hehe, ‘meaning’ the same thing but not actually ‘saying’ the same thing :wink:

(for brevity and levity :>filename )

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.