• 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

Issue logrotate with dateext issue

mvais

Basic Pleskian
We enabled dateext for all domains by editing the file logrotate.conf.
cat /usr/local/psa/etc/logrotate.conf
dateext


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


Now the directory /var/www/vhosts/system/domain.com/logs/ behaves like expected:
ll /var/www/vhosts/system/domain.com/logs/
total 604
-rw-r--r-- 2 root root 4954 Jan 16 09:22 access_log
-rw-r--r-- 2 root root 0 Jan 16 03:28 access_log.processed
-rw-r--r-- 2 root root 2342 Jan 3 03:16 access_log.processed-20170103.gz
-rw-r--r-- 2 root root 1758 Jan 4 03:21 access_log.processed-20170104.gz
-rw-r--r-- 2 root root 1696 Jan 5 03:11 access_log.processed-20170105.gz
-rw-r--r-- 2 root root 1807 Jan 6 03:46 access_log.processed-20170106.gz
-rw-r--r-- 2 root root 1384 Jan 7 03:38 access_log.processed-20170107.gz
-rw-r--r-- 2 root root 2904 Jan 8 03:35 access_log.processed-20170108.gz
-rw-r--r-- 2 root root 2063 Jan 9 03:47 access_log.processed-20170109.gz
-rw-r--r-- 2 root root 2607 Jan 10 03:18 access_log.processed-20170110.gz
-rw-r--r-- 2 root root 2051 Jan 11 03:44 access_log.processed-20170111.gz
-rw-r--r-- 2 root root 1225 Jan 12 03:48 access_log.processed-20170112.gz
-rw-r--r-- 2 root root 2205 Jan 13 03:18 access_log.processed-20170113.gz
-rw-r--r-- 2 root root 1770 Jan 14 03:20 access_log.processed-20170114.gz
-rw-r--r-- 2 root root 1310 Jan 15 03:36 access_log.processed-20170115.gz
-rw-r--r-- 2 root root 1605 Jan 16 03:28 access_log.processed-20170116.gz

...


But in the directory /var/www/vhosts/domain.com/logs/ the rotation doesn't happen. The files go back till the day i switched to dateext:
ll /var/www/vhosts/domain.com/logs/
total 1864
-rw-r--r-- 2 root root 4954 Jan 16 09:22 access_log
-rw-r--r-- 2 root root 0 Jan 16 03:28 access_log.processed
-rw-r--r-- 1 root root 3388 Dec 7 03:20 access_log.processed-20161207.gz
-rw-r--r-- 1 root root 2590 Dec 8 03:15 access_log.processed-20161208.gz
-rw-r--r-- 1 root root 2787 Dec 9 03:25 access_log.processed-20161209.gz
-rw-r--r-- 1 root root 1971 Dec 10 03:46 access_log.processed-20161210.gz
-rw-r--r-- 1 root root 2206 Dec 11 03:08 access_log.processed-20161211.gz
-rw-r--r-- 1 root root 2167 Dec 12 03:50 access_log.processed-20161212.gz
-rw-r--r-- 1 root root 2297 Dec 13 03:18 access_log.processed-20161213.gz
-rw-r--r-- 1 root root 2325 Dec 14 03:33 access_log.processed-20161214.gz
-rw-r--r-- 1 root root 1634 Dec 15 03:50 access_log.processed-20161215.gz
-rw-r--r-- 1 root root 1804 Dec 16 03:14 access_log.processed-20161216.gz
-rw-r--r-- 1 root root 1819 Dec 17 03:13 access_log.processed-20161217.gz
-rw-r--r-- 1 root root 1559 Dec 18 03:51 access_log.processed-20161218.gz
-rw-r--r-- 1 root root 1533 Dec 19 03:07 access_log.processed-20161219.gz
-rw-r--r-- 1 root root 2492 Dec 20 03:31 access_log.processed-20161220.gz
-rw-r--r-- 1 root root 1353 Dec 21 03:25 access_log.processed-20161221.gz
-rw-r--r-- 1 root root 2469 Dec 22 03:15 access_log.processed-20161222.gz
-rw-r--r-- 1 root root 2307 Dec 23 03:35 access_log.processed-20161223.gz
-rw-r--r-- 1 root root 1980 Dec 24 03:29 access_log.processed-20161224.gz
-rw-r--r-- 1 root root 6084 Dec 25 03:28 access_log.processed-20161225.gz
-rw-r--r-- 1 root root 1874 Dec 26 03:17 access_log.processed-20161226.gz
-rw-r--r-- 1 root root 1553 Dec 27 03:28 access_log.processed-20161227.gz
-rw-r--r-- 1 root root 2421 Dec 28 03:35 access_log.processed-20161228.gz
-rw-r--r-- 1 root root 1999 Dec 29 03:44 access_log.processed-20161229.gz
-rw-r--r-- 1 root root 2254 Dec 30 03:41 access_log.processed-20161230.gz
-rw-r--r-- 1 root root 2045 Dec 31 03:08 access_log.processed-20161231.gz
-rw-r--r-- 1 root root 1723 Jan 1 03:14 access_log.processed-20170101.gz
-rw-r--r-- 1 root root 2515 Jan 2 03:37 access_log.processed-20170102.gz
-rw-r--r-- 2 root root 2342 Jan 3 03:16 access_log.processed-20170103.gz
-rw-r--r-- 2 root root 1758 Jan 4 03:21 access_log.processed-20170104.gz
-rw-r--r-- 2 root root 1696 Jan 5 03:11 access_log.processed-20170105.gz
-rw-r--r-- 2 root root 1807 Jan 6 03:46 access_log.processed-20170106.gz
-rw-r--r-- 2 root root 1384 Jan 7 03:38 access_log.processed-20170107.gz
-rw-r--r-- 2 root root 2904 Jan 8 03:35 access_log.processed-20170108.gz
-rw-r--r-- 2 root root 2063 Jan 9 03:47 access_log.processed-20170109.gz
-rw-r--r-- 2 root root 2607 Jan 10 03:18 access_log.processed-20170110.gz
-rw-r--r-- 2 root root 2051 Jan 11 03:44 access_log.processed-20170111.gz
-rw-r--r-- 2 root root 1225 Jan 12 03:48 access_log.processed-20170112.gz
-rw-r--r-- 2 root root 2205 Jan 13 03:18 access_log.processed-20170113.gz
-rw-r--r-- 2 root root 1770 Jan 14 03:20 access_log.processed-20170114.gz
-rw-r--r-- 2 root root 1310 Jan 15 03:36 access_log.processed-20170115.gz
-rw-r--r-- 2 root root 1605 Jan 16 03:28 access_log.processed-20170116.gz

...


How does plesk manage the second directory. I have no idea what to do. Can someone give me a hint?
 
Plesk uses two path which contains logfiles for the domains (they use hardlinks):
/var/www/vhosts/system/domain.com/logs/
/var/www/vhosts/domain.com/logs/

Without dateext format the logfiles in both directories are rotated. But when I change to dateext in both directories the format applies but in the second one (without system in path) the old files won't be removed. I assume plesk does this behind the scenes because in /usr/local/psa/etc/logrotate.d/domain.com only the path with system is specified.

In my opening post you can see that all files in the first list have 2 hardlinks (the second column after permissions). In the second list you see there are lots of files with 1 hardlinks. These files where removed (by logrotate as expected) in the directory with system in path.

Hope this is more understandable.
 
Hi mvais,

the files at "/var/www/vhosts/domain.com/logs/" are used for the Plesk Log Browser. The files are copies from the original sources ( i.e. "/var/www/vhosts/system/domain.com/logs/" ). If you desire to delete the files at "/var/www/vhosts/domain.com/logs/", you might consider to do this over your Plesk Control Panel: => HOME > Domains ( (sub)YOUR-DOMAN.COM > Logs
 
But in my opinion it should behave like it does without dateext and the files are being deleted automatically by the system. I can't manually deleted these files for hundreds of domains. These files should be deleted by plesk like they are if dateext isn't enabled.

If I set the rotation to keep 14 files I expect both directories keep 14 files and delete the old ones. It shouldn't matter if I use dateext or not.
 
Back
Top