Only end of month days are logged
saloustrosm opened this issue · 1 comments
At 2.7.0 version (also 2.6.0 which is checked) only the last days of month logs are collected.
Same reference was made at #26 and closed but it is still here.
Bellow is the last 30 logs (default config) which show the problem where the last days of each month are collected instead of the last 30days of the last month.
ls -lat /root/.pm2/logs/ | grep pm2-logrotate-out
6418 Aug 7 13:35 pms-out.log
8836 Jul 31 00:00 pms-out__31-07-2020_00-00-00.log
10845 Jul 30 00:00 pms-out__30-07-2020_00-00-00.log
14130 Jul 29 00:00 pms-out__29-07-2020_00-00-00.log
10150 Jul 28 00:00 pms-out__28-07-2020_00-00-00.log
14283 Jul 27 00:00 pms-out__27-07-2020_00-00-00.log
16669 Jul 26 00:00 pms-out__26-07-2020_00-00-00.log
103075 Jun 30 00:00 pms-out__30-06-2020_00-00-00.log
103075 Jun 29 00:00 pms-out__29-06-2020_00-00-00.log
102920 Jun 28 00:00 pms-out__28-06-2020_00-00-00.log
103075 Jun 27 00:00 pms-out__27-06-2020_00-00-00.log
102920 Jun 26 00:00 pms-out__26-06-2020_00-00-00.log
102920 May 31 00:00 pms-out__31-05-2020_00-00-00.log
103075 May 30 00:00 pms-out__30-05-2020_00-00-00.log
102920 May 29 00:00 pms-out__29-05-2020_00-00-00.log
103075 May 28 00:00 pms-out__28-05-2020_00-00-00.log
103075 May 27 00:00 pms-out__27-05-2020_00-00-00.log
102920 May 26 00:00 pms-out__26-05-2020_00-00-00.log
102920 Apr 30 00:00 pms-out__30-04-2020_00-00-00.log
103075 Apr 29 00:00 pms-out__29-04-2020_00-00-00.log
102920 Apr 28 00:00 pms-out__28-04-2020_00-00-00.log
103075 Apr 27 00:00 pms-out__27-04-2020_00-00-00.log
103075 Apr 26 00:00 pms-out__26-04-2020_00-00-00.log
103075 Mar 31 00:00 pms-out__31-03-2020_00-00-00.log
98735 Mar 30 00:00 pms-out__30-03-2020_00-00-00.log
102920 Mar 29 00:00 pms-out__29-03-2020_00-00-00.log
103075 Mar 28 00:00 pms-out__28-03-2020_00-00-00.log
103077 Mar 27 00:00 pms-out__27-03-2020_00-00-00.log
103075 Feb 29 00:00 pms-out__29-02-2020_00-00-00.log
103075 Feb 28 00:00 pms-out__28-02-2020_00-00-00.log
68762 Feb 27 00:00 pms-out__27-02-2020_00-00-00.log
This problem occurs when someone does not use format "YYYY-MM-DD_HH-mm-ss"
There is a rotated_files.sort().reverse() of filenames at line 77 of app.js which sorts alphabetically and after that it removes the first files until it reaches the "retain" point. Use "YYYY-MM-DD_HH-mm-ss" instead in order to have proper ordering and removal of the older files.
This is a workaround so i do not close this issue.