Few days ago, my webapp stopped work, i checked on the server and it was stopped in pm2 and didn't want restart. I figured that the disk was full (25Gb) so i took an upgrade to 80Gb and installed logrotate but today, 2 days after, the disk is full again.
I did a flush logs command with sudo pm2 flush
, which did bring it from 80Gb to 61Gb.
Then i figured that the .pm2/logs folder was 57Gb and i see 150 log files like "sign-out__2021-02-13_05-36-03.log" for the app for a single day, how can i fix that?
Here my logrotate default config:
"pm2-logrotate": {
"max_size": "10M",
"retain": "30",
"compress": false,
"dateFormat": "YYYY-MM-DD_HH-mm-ss",
"workerInterval": "30",
"rotateInterval": "0 0 * * *",
"rotateModule": true
},
"module-db-v2": {
"pm2-logrotate": {}
}
}
If i understand it well it shouldn keep more than 30 of 10Mb max so 57Gb is not normal.
I deleted all sign-out__2021-02-13_05-36-*.log files and down to 8Gb
I stopped logrotate for now and its ok but would like to know how to solve this issue
Thank you in advance