• 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Create daily access logs

HielkeJ

New Pleskian
Hello,

I want to save the access logs of our websites on an external server. If I do this now with the default setup, the gets overwritten every day. The desired file name format whould be: websitedomain-tld-access-2014-10-24.log

How can I tell Plesk to do this and how can I make sure the statistics keep working?

On our other servers we use rotatelogs for this.

Thanks!
 
You might edit the domain-specific logrotate - definitions, located at "/usr/local/psa/etc/logrotate.d" . An example, based on your specifications would be:

Code:
/var/www/vhosts/system/YOUR-SPECIFIC-DOMAIN.COM/logs/access_log {
    daily
    missingok
    rotate 30
    notifempty
    dateext
    nocompress
    nomail
    dateformat _YOUR-SPECIFIC-DOMAIN.COM-%Y-%m-%d.log
}
/var/www/vhosts/system/YOUR-SPECIFIC-DOMAIN.COM/logs/proxy_access_log {
    daily
    missingok
    rotate 30
    notifempty
    dateext
    nocompress
    nomail
    dateformat _YOUR-SPECIFIC-DOMAIN.COM-%Y-%m-%d.log
}
As you can see, the definition would add a date-extension to the rotated log, so the rotated logs would look this way: access-log_YOUR-SPECIFIC-DOMAIN.COM-2014-10-24.log or proxy_access-log_YOUR-SPECIFIC-DOMAIN.COM-2014-10-24.log.


Be aware, that the files in "/usr/local/psa/etc/logrotate.d" might get overritten by Plesk in case of updates/upgrades/patches, or if you change settings for a subscription plan or for domain. This mentioned on the top of all files.
 
Thank you for this solution. Is there an option to make sure that the lines are added after a change / update?

If that is not possible, I will create a script and start that with the event handler.
 
Sure, HielkeJ,

just make an exact copy of the log - rotation file and name it to your desired name ( i.e.: "apache2" to "zzz_apache2" ... in your case maybe: DOMAIN_NAME.apache2 ). When you rename these files they are still executed, so you might want to delete doubles with different names, so your logrotation doesn't do the same job twice, when rotating the logs.
 
Back
Top