• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Forwarded to devs logrotate proxy_error_log with dateext issue

mvais

Basic Pleskian
TITLE:
logrotate proxy_error_log with dateext issue
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Plesk Obsidian Version 18.0.16, CentOS Linux 7.6.1810 (Core)‬, x64
PROBLEM DESCRIPTION:
When adding the line dateext on top of /usr/local/psa/etc/logrotate.conf the dateext format is applied to both directories:
/var/www/vhosts/system/domain.com/logs/
/var/www/vhosts/domain.com/logs/
But in the one without system in the path the old proxy_error_log files won't be deleted. This causes that every file since the day i switched to dateext is kept in /var/www/vhosts/domain.com/logs/ for most of the domains. In the other directory it works like expected.

In the actual case the error happens for the most domains but not all. I didn't found any clues why.

This is the same behavior as described in the following bug with the exception that it only affects the proxy_error_log.
[PPP-28469] logrotate with dateext issue
STEPS TO REPRODUCE:
Add dateext to the top of /usr/local/psa/etc/logrotate.conf
It looks like this for me (i want dateext for all logs):
cat /usr/local/psa/etc/logrotate.conf
dateext

include /usr/local/psa/etc/logrotate.d
...

Than wait till there are proxy_error_log files which should be removed.​
ACTUAL RESULT:
Only the proxy_error_log files in /var/www/vhosts/system/domain.com/logs/ are deleted after the specific amount for example 14 logs (depends on the logs to keep setting per domain).
The files in /var/www/vhosts/domain.com/logs/ are kept forever.​
EXPECTED RESULT:
Both directories should deleted the old files. Like it's already done in the directory /var/www/vhosts/system/domain.com/logs/
It shouldn't behave different with dateext enabled. Without dateext in both directories are the same amount of logfiles in both directories.​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Confirm bug
 
From developer:

I could not reproduce.
I tried to specify dateext and fill proxy_error_log. It rotated as expected.
The files in /var/www/vhosts/<domain>/logs are hardlinks to /var/www/vhosts/system/<domain>/logs
Code:
# stat /var/www/vhosts/a10-52-67-99.qa.plesk.ru/logs/proxy_error_log
File: «/var/www/vhosts/a10-52-67-99.qa.plesk.ru/logs/proxy_error_log»
Size: 31457280 Blocks: 61440 Block IO В/В: 4096
Device: 802h/2050d Inode: 1079519537 Links: 2

Code:
# dd if=/dev/urandom of=/var/www/vhosts/system/a10-52-67-99.qa.plesk.ru/logs/proxy_error_log bs=1M count=30
# /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=a10-52-67-99.qa.plesk.ru

Result:
Code:
[root@a10-52-67-99 ~]# ls -lh /var/www/vhosts/a10-52-67-99.qa.plesk.ru/logs/
итого 61M
-rw-r--r--. 2 root root 0 Jul 29 15:00 access_ssl_log
-rw-r--r--. 2 root root 199 Jul 29 16:11 error_log
-rw-r--r--. 2 root root 31M Jul 29 16:04 error_log-2019-07-29-1564391101.gz
-rw-r--r--. 2 root root 0 Jul 29 15:00 proxy_access_ssl_log
-rw-r--r--. 2 root root 0 Jul 29 16:07 proxy_error_log
-rw-r--r--. 2 root root 31M Jul 29 16:06 proxy_error_log-2019-07-29-1564391245.gz
 
Thank you for your reply, Igor. But the developer did not test what I described. In general, rotation works, but the retention of logs is buggy!

In this example, we have a daily rotation with a retention of 10 logs. Look at the logs in /var/www/vhosts/mydomain.ch/logs/ from 19. July and older, they only have 1 hardlink left but should be deleted instead:
Code:
[root@myserver ~]# ll /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log*
-rw-r--r-- 2 nginx root   0 Jul 30 03:14 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log
-rw-r--r-- 2 nginx root  20 Jul 20 03:48 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190721.gz
-rw-r--r-- 2 nginx root  20 Jul 21 03:23 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190722.gz
-rw-r--r-- 2 nginx root  20 Jul 22 03:12 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190723.gz
-rw-r--r-- 2 nginx root  20 Jul 23 03:14 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190724.gz
-rw-r--r-- 2 nginx root 239 Jul 24 08:13 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190725.gz
-rw-r--r-- 2 nginx root  20 Jul 25 03:41 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190726.gz
-rw-r--r-- 2 nginx root  20 Jul 26 03:08 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190727.gz
-rw-r--r-- 2 nginx root  20 Jul 27 03:52 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190728.gz
-rw-r--r-- 2 nginx root  20 Jul 28 03:31 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190729.gz
-rw-r--r-- 2 nginx root 229 Jul 29 09:24 /var/www/vhosts/system/mydomain.ch/logs/proxy_error_log-20190730.gz
[root@myserver ~]# ll /var/www/vhosts/mydomain.ch/logs/proxy_error_log*
-rw-r--r-- 2 nginx root   0 Jul 30 03:14 /var/www/vhosts/mydomain.ch/logs/proxy_error_log
-rw-r--r-- 1 nginx root  20 Jun 26 03:19 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190627.gz
-rw-r--r-- 1 nginx root  20 Jun 27 03:43 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190628.gz
-rw-r--r-- 1 nginx root  20 Jun 28 03:38 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190629.gz
-rw-r--r-- 1 nginx root  20 Jun 29 03:43 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190630.gz
-rw-r--r-- 1 nginx root  20 Jun 30 03:12 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190701.gz
-rw-r--r-- 1 nginx root  20 Jul  1 03:14 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190702.gz
-rw-r--r-- 1 nginx root  20 Jul  2 03:31 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190703.gz
-rw-r--r-- 1 nginx root  20 Jul  3 03:25 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190704.gz
-rw-r--r-- 1 nginx root  20 Jul  4 03:17 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190705.gz
-rw-r--r-- 1 nginx root  20 Jul  5 03:19 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190706.gz
-rw-r--r-- 1 nginx root  20 Jul  6 03:12 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190707.gz
-rw-r--r-- 1 nginx root  20 Jul  7 03:19 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190708.gz
-rw-r--r-- 1 nginx root  20 Jul  8 03:41 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190709.gz
-rw-r--r-- 1 nginx root  20 Jul  9 03:34 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190710.gz
-rw-r--r-- 1 nginx root  20 Jul 10 03:22 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190711.gz
-rw-r--r-- 1 nginx root  20 Jul 11 03:36 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190712.gz
-rw-r--r-- 1 nginx root  20 Jul 12 03:22 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190713.gz
-rw-r--r-- 1 nginx root  20 Jul 13 03:31 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190714.gz
-rw-r--r-- 1 nginx root  20 Jul 14 03:24 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190715.gz
-rw-r--r-- 1 nginx root  20 Jul 15 03:51 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190716.gz
-rw-r--r-- 1 nginx root  20 Jul 16 03:15 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190717.gz
-rw-r--r-- 1 nginx root  20 Jul 17 03:52 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190718.gz
-rw-r--r-- 1 nginx root  20 Jul 18 03:40 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190719.gz
-rw-r--r-- 1 nginx root  20 Jul 19 03:26 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190720.gz
-rw-r--r-- 2 nginx root  20 Jul 20 03:48 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190721.gz
-rw-r--r-- 2 nginx root  20 Jul 21 03:23 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190722.gz
-rw-r--r-- 2 nginx root  20 Jul 22 03:12 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190723.gz
-rw-r--r-- 2 nginx root  20 Jul 23 03:14 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190724.gz
-rw-r--r-- 2 nginx root 239 Jul 24 08:13 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190725.gz
-rw-r--r-- 2 nginx root  20 Jul 25 03:41 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190726.gz
-rw-r--r-- 2 nginx root  20 Jul 26 03:08 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190727.gz
-rw-r--r-- 2 nginx root  20 Jul 27 03:52 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190728.gz
-rw-r--r-- 2 nginx root  20 Jul 28 03:31 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190729.gz
-rw-r--r-- 2 nginx root 229 Jul 29 09:24 /var/www/vhosts/mydomain.ch/logs/proxy_error_log-20190730.gz
 
Back
Top