• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Input Enabling and Configuring Logroation via CLI

AK_learner

Basic Pleskian
Server operating system version
CentOS Linux release 7.9.2009
Plesk version and microupdate number
Plesk Obsidian 18.0.50.2
Hi Pleskians,

I was wondering if there was any option to enable the logroation by size on each domains via CLI?
The GUI method (Domains > example.com > Websites & Domains > Logs > Manage Log Files > Log Rotation) is painstakingly very time consuming, if you thing about 100+ domains.

The server settings option (Tools & Settings > Server Settings > Force daily log rotation for all domains and specify how long logs will be kept) is only basis the number of days the file should be kept but does not have the option to rotate basis the size.

Can you suggest if there are any ways? If so that would be very helpful.
 

Attachments

  • Screenshot 2023-03-26 at 9.49.57 AM.png
    Screenshot 2023-03-26 at 9.49.57 AM.png
    109.9 KB · Views: 1
Hi Pleskians,

There is a slight change to the command as suggested by IgorG.

The -log-bytime value when used at the end overrides the -log-bysize value.
# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/site --update $i -log-rotate true -log-bysize 1G -log-max-num-files 3 -log-bytime monthly -log-compress true; done

Furthermore, as per the article we can modify as below with Plesk's inbuilt CLI:
plesk bin domain -l| while read dom_name; do plesk bin domain -u $dom_name -log-rotate true -log-bysize 500M -log-max-num-files 7 -log-compress true; done
The above command sets the following values:
Log Rotation = True
Log rotation condition = By size (size here set to 500 Mb)
Maximum number of log files = 7
Compress log files = True
Email the log files = False (as we haven't set that in the above command).

However, if you had the email-id set earlier, use the below set of commands:
plesk bin site --list > /root/domains.txt <-------- Create a list of all domains
cat /root/domains.txt | while read i; do plesk bin site -u $i -log-email ""; done <-------- Run the command to disable sending notifications

Post the above settings I got the desired log rotation (snapshot attached for reference).

Cheers!;)
 

Attachments

  • Screenshot 2023-03-26 at 10.55.58 AM.png
    Screenshot 2023-03-26 at 10.55.58 AM.png
    106.7 KB · Views: 1
Back
Top