keymetrics / pm2-logrotate

Automatically rotate all applications logs managed by PM2
1.25k stars 138 forks source link

pm2-logrotate rotates standard error but not standard output #128

Open alopumomovia opened 5 years ago

alopumomovia commented 5 years ago

pm2-logrotate rotates standard error but not standard output. This is the content of ~/.pm2/module_conf.json

{ "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": {} } }

Actually, looking into pm2-logrotate-out.log, it does rotate the log but it deletes it immediately:

"/home/app/.pm2/logs/app-out__2019-05-09_11-20-05.log" has been created "app-out__2019-05-09_11-20-05.log" has been deleted

Note: there are no rotated files:

$ ls -lrt app-out__* ls: cannot access 'app-out__*': No such file or directory

pm2 version is 3.2.2

Serverfault: https://serverfault.com/questions/966536/pm2-logrotate-rotates-standard-error-but-not-standard-output

Ginden commented 4 years ago

@alopumomovia I have the same issue. Did you have any luck with that?

alopumomovia commented 4 years ago

I disabled the retain option and it works

"retain": "3650000",

This is the complete change I made:

<     "max_size": "10M",
<     "retain": "30",
<     "compress": false,
---
>     "max_size": "50M",
>     "retain": "3650000",
>     "compress": true,
matcho commented 6 months ago

Also, see https://serverfault.com/a/1037002 : just renamed a process from 3-letter to 6-letter, problem solved :sweat_smile: