• 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
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Logrotate Not Working

LloydD

Basic Pleskian
Hi everyone,
I'm running a VPS with Ubuntu 8.04 LTS with Plesk 9.5.4 and set the domains to rotate once a month but it never happened so now I have a 340mb access.log and 160MB access_ssl.log.
There's no logrotate file in /etc/cron.monthly just a .50plesk-monthly and .place-holder. There is a logrotate file in the cron-daily folder.
Is there a command I can run on a per domain basis?
Thanks in advance for any help
Kind regards

Lloyd
 
cat /etc/cron.daily/logrotate

#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
 
Sorry for the delay,

/etc/cron.daily/logrotate

#!/bin/sh

test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf

and

/etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0664 root utmp
rotate 1
}

# system-specific logs may be configured here

There is no logrotate in /etc/cron.monthly.
Thanks in advance for your help
Kind regards

Lloyd
 
That all looks pretty normal - can you double check that you actually set the domains to use logrotate and its by date and not by size or number?
 
The system has been running for about a year and a half, in that time I have tried monthly daily and by size, none work.
I just ran

logrotate -f /etc/logrotate.conf

Which rotated alot of logs, but didn't touch the domain logs.
Should Plesk have written something to the logrotate.conf?
Something like..

/var/www/vhosts/domain wildcard?/statistics/logs/* {
missingok
monthly
create 0664 root utmp
rotate 1
}

I don't know, I hope someone can shed some light on the subject.
Thanks for the help so far.
Kind regards

Lloyd
 
Ok so I have found where Plesk stores the logrotate files for the domains..

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

Should I just add the above path to the /etc/logrotate.conf?
Thanks for your patience
 
Plesk logrotate settings are stored here

/usr/local/psa/etc/logrotate.conf

it has a include line as its #1 line
include /usr/local/psa/etc/logrotate.d

inside that directory you will find the domains, and each domain will have its log files there

# cat domain.com
/var/www/vhosts/domain.com/statistics/logs/*.processed {
daily
rotate 3
compress
missingok
}
/var/www/vhosts/domain.com/statistics/logs/error_log {
daily
rotate 3
compress
missingok
copytruncate
}
 
Well that nearly did the trick, to start with it only did the error log so I just copied that entry in /usr/local/psa/etc/logrotate.d/my-domain.com and corrected the access_log and access_ssl_log file paths.
Job done, except how do I get it to do it monthly automatically
Should I ammend the main /etc/logrotate.conf so there are 2 include entries..

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

Or should I just add a cron job to run it.
Thanks for all your help on this matter, it's much appreciated
 
Back
Top