1

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

Gibezynu
  • 11
  • 4

1 Answers1

0

it's because of the short application name 'app' with only 3 characters.

somehow the old log deletion script of pm2-logrotate would behave weirdly when the log filename is too short.

just delete it from pm2 and start it again with a longer app name then it should be fine. (renaming the app probably would not work because the log filename would still remain the same)

raj72616a
  • 1
  • 1