• 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
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Resolved Synchronizing access log problem

frame86

New Pleskian
Server operating system version
Ubuntu 18.04.4 LTS
Plesk version and microupdate number
18.0.50
Hello,

which service / job is responsible for synchronizing access logs to user home directories?

The logs in vhosts/system are still written but for some reason stopped to sychronize - all domains are affected.
 
Already did that. Besides that, shouldn't it run as root anyway? Access logs are owned by root.

We just want to know how the synchronization is done.

If it is done by PHP then maybe AppArmor blocks something but does not log it.
if it is done by a job please tell us which one so we can investigate.
 
I don't think there is a standing order on log syncs as this is a onetime hard link setup, but I may be wrong. As the files in the user logs directories are hard linked to the /var/www/vhosts/system/<domain>/logs files, no manual syncing is necessary. For that reason I thought of the "repair fs", it might also be a "repair web <your domain>" that helps.

You can try to relink the logs like
as root plesk sbin relink-vhost-logs --domain-name <domain.tld> --sys-user-login <subscription user name> --create
If you do not know the subscription user of a domain, this db query will get it for you:
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='<domain>';"

If you want to relink the files for all domains,
Code:
# 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
and then
Code:
# 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

If you like, you can check whether the nightly maintenance jobs are running.

You can run these tasks separately, too:
But there is no specific tasks to create or update the hard links.
 
Thank you! I guess that explains why the logs are not working :D

Because we recently changed the mount for /var/www/vhosts and copied all data to a new device - and hardlinks were not preserved then.

Indeed repair -fs didn't check that, find /var/www/vhosts/<domain> -samefile /var/www/vhosts/system/<domain>/logs/access_log shows nothing.
 
Back
Top