pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

Log files suffix with .1

Open fsfarah opened this issue 8 years ago • 1 comments

Log files always suffixed with .1 at the end whether error or out

e.g. my-process-name-out-9.log.1

This is affecting PM2 log-rotate plugin, it's unable to locate the log file because of this.

When I pm2 flush then pm2 reloadLogs it works fine, temporarily. The log files don't have .1 at the end

I even tried pm2 save after that.

The next day it's the same story. I find that the logs are being created suffixed with .1

I'm using PM2 to manage multiple processes.

To start them I have used a JSON containing an array, like this:

[{
  "name": "my-process",
  "cwd": "path/to/my-process",
  "script": "index.js",
  "exec_mode": "fork",
  "env": {
    "NODE_ENV": "production"
  }
},
]

How could we reproduce this issue?

I'm not sure how to reproduce this issue, maybe if I did I would figure it out.

Supporting information

$ pm2 report
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 2.6.1
node version         : 6.11.2
node path            : undefined
argv                 : /usr/bin/nodejs,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : fouad
uid                  : 1000
gid                  : 1000
uptime               : 320616min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 2.6.1
node version         : 6.11.2
node path            : /usr/bin/pm2
argv                 : /usr/bin/nodejs,/usr/bin/pm2,report
argv0                : node
user                 : fouad
uid                  : 1000
gid                  : 1000
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU @ 2.60GHz
cpus nb              : 2
freemem              : 2106396672
totalmem             : 7843016704
home                 : /home/fouad

fsfarah avatar Apr 19 '18 06:04 fsfarah

As it turns out there's a native logrotate config that is probably interfering with this

/home/fouad/.pm2/pm2.log /home/fouad/.pm2/logs/*.log {
        rotate 12
        weekly
        missingok
        notifempty
        compress
        delaycompress
        create 0640 fouad fouad
}

I removed the above file and things seem to be back to normal

fsfarah avatar Apr 20 '18 09:04 fsfarah