Applicable to:
- Plesk Onyx for Linux
- Plesk Obsidian for Linux
Question
How to recreate log files hard link structure?
Answer
-
Log in to Plesk server using SSH.
-
Find the system user for the affected domain:
# plesk db "select d.name,s.login from domains d join hosting h on d.id = h.dom_id join sys_users s on h.sys_user_id=s.id where d.name='example.com';"
+-------------+---------+
| name | login |
+-------------+---------+
| example.com | jdoe |
+-------------+---------+ -
Recreate the structure:
# plesk sbin relink-vhost-logs --domain-name example.com --sys-user-login jdoe --create
-
Log in to Plesk server using SSH.
-
Move all files from
/var/www/vhosts/*/logs/
directories:# mkdir /root/temp
# plesk db -Ne 'select name from domains where htype="vrt_hst"' | xargs -I '{}' mkdir -p /root/temp/'{}'
# for i in `plesk db -Ne 'select name from domains where htype="vrt_hst"'` ; do mv /var/www/vhosts/$i/logs/* /root/temp/$i/; done -
Use the following command, which will re-create hardlink structure for all the domains with physical hosting enabled:
# plesk db -Nse "select name from domains where htype='vrt_hst'" | while read dom; do export sys=/var/www/vhosts/system/$dom/logs/; ls -1 $sys | while read fil; do ln -P $sys/$fil /var/www/vhosts/$dom/logs/; done; done
Comments
2 comments
I have executed the above fix for all domains.
Then, when I try to rebuild stats following the fix above, I keep getting errors (whether I do one domain or all).
-----[ thisdomain.org
Webstat: awstats
Executing awstats...
Skip log/var/www/vhosts/system/thisdomain.org/logs/access_log.webstat because it is empty or does not exist
Processing the log /var/www/vhosts/system/thisdomain.org/logs/access_ssl_log.webstat
/usr/lib/cgi-bin/awstats.pl -update -configdir=/opt/psa/etc/awstats -config=thisdomain.org-https -LogFile=/var/www/vhosts/system/thisdomain.org/logs/access_ssl_log.webstat
Skip log `proxy_access_log' because it has parent `access_log'
Skip log `proxy_access_ssl_log' because it has parent `access_ssl_log'
Skip log/var/www/vhosts/system/thisdomain.org/logs/xferlog.webstat because it is empty or does not exist
Skip log/var/www/vhosts/system/thisdomain.org/logs/xferlog_regular.webstat because it is empty or does not exist
[2020-10-03 13:35:19.316] DEBUG [util_exec] [5f78b652e1c1d] Stdout: Stat_ttl for the domain is 3.Finished.
thanks for any insight into my issue.
stu
Hello @Stu (Rader) Liedtke!
I don't see any issues or errors in the provided output - the log file access_ssl_log.webstat was processed, other log files were skipped for specified reasons (empty or doesn't exist, has parent).
If any further assistance is required, consider submitting a support ticket or starting a thread on our forum.
Please sign in to leave a comment.