keymetrics/pm2-logrotate

`max_size` does not work properly in `cluster mode.`

ewxm opened this issue · 2 comments

ewxm commented

After pm2-logrotate is upgraded to version 2.7.0, only one process's log is cut in cluster mode, and other processes' logs continue to grow. But it works in version 2.6.0.


 ⚡ root@node6 > /data/log/pm2 > ll -lh
total 7.5G
-rw-r--r-- 1 root root  94M 2020-02-26 00:12:00 shop-err-3__2020-02-26_00-00-00.log
-rw-r--r-- 1 root root  21M 2020-02-26 09:09:17 shop-err-3.log
-rw-r--r-- 1 root root 114M 2020-02-26 09:09:17 shop-err-4.log
-rw-r--r-- 1 root root 113M 2020-02-26 09:09:17 shop-err-5.log
-rw-r--r-- 1 root root 503M 2020-02-25 20:08:58 shop-out-3__2020-02-25_20-13-58.log
-rw-r--r-- 1 root root 502M 2020-02-25 21:09:28 shop-out-3__2020-02-25_21-26-28.log
-rw-r--r-- 1 root root 502M 2020-02-25 22:10:58 shop-out-3__2020-02-25_22-33-58.log
-rw-r--r-- 1 root root 408M 2020-02-26 00:12:00 shop-out-3__2020-02-26_00-00-00.log
-rw-r--r-- 1 root root 399M 2020-02-26 09:09:17 shop-out-3.log
-rw-r--r-- 1 root root 2.3G 2020-02-26 09:09:17 shop-out-4.log    <- - - - - -
-rw-r--r-- 1 root root 2.3G 2020-02-26 09:09:17 shop-out-5.log    <- - - - - -

 ⚡ root@node6 > /data/log/pm2 > pm2 -v   
4.2.3
 ⚡ root@node6 > /data/log/pm2 > npm -v                    
6.13.4
 ⚡ root@node6 > /data/log/pm2 > node -v
v12.16.0
 ⚡ root@node6 > /data/log/pm2 > pm2 show pm2-logrotate
 ...
 Process configuration
┌────────────────┬─────────────────────┐
│ rotateModule   │ true                │
│ rotateInterval │ 0 0 * * *           │
│ workerInterval │ 30                  │
│ dateFormat     │ YYYY-MM-DD_HH-mm-ss │
│ compress       │ false               │
│ retain         │ 30                  │
│ max_size       │ 500M                │
└────────────────┴─────────────────────┘
...

i am facing the same problem, is there any solution?

ewxm commented

i am facing the same problem, is there any solution?

pm2 uninstall pm2-logrotate
pm2 install pm2-logrotate@2.6.0