• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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