On October 19, 2021, we have enabled single-sign-on for our Plesk Support Center to provide a seamless login/account experience. This implies that you’ll be able to use a single account across any of our web-facing properties.
If you had already registered your account at Plesk 360 (formerly known as My Plesk) please use one for login. Otherwise please re-register it using the same email address as your existing Zendesk login (support account). It’s essential that you use the same email address on our support center to ensure that your tickets stay attached to the same account.

How to change log rotation settings for all domains at once?

Follow

Comments

11 comments

  • Avatar
    Christopher Danks

    the windows log.zip does not work on Onyx 17.8

    a quick fix

     

    Replace the 3 top lines:

     

    @echo off
    set /p password="Please enter your Plesk administrator password: "


    "%plesk_dir%\MySQL\bin\mysql.exe" -uadmin -p%password% -P8306 psa -s -r -e "select name from domains" > domains.txt

     

    with these 2 lines:

     

    @echo off
    plesk db -s -r -e "select name from domains" > domains.txt

    0
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Christopher

    I verified the fix and added the updated script to the article. Thank you for your input.

    0
    Comment actions Permalink
  • Avatar
    Gianluca

    Both the links to download (for Plesk 12.5 and older or for Plesk Onyx and newer) are wrong.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Gianluca!

    Thank you for noticing, links were fixed.

    0
    Comment actions Permalink
  • Avatar
    Greg Dinger

    I'm confused.
    March 26, 2018 Christopher Danks reports that the windows log.zip has an issue.


    Same Date Denis Bykov confirms above and updated the article


    Today October 15, 2021 I downloaded log.zip and examined the log.bat file. It contains what was first recorded, and the file is dated 10/20/2016.

    I'm new enough to this environment that I'm afraid of making a mistake. Can someone confirm why the above reported change was not applied to the bat file?

    0
    Comment actions Permalink
  • Avatar
    Vladimir Chernikov
    Hello @Greg Dinger,
     
    The script was updated. Thank you for bringing this to our attention! Both versions of the script are working, the only difference is the adjusted script will not require to input Plesk admin password to retrieve data.
    0
    Comment actions Permalink
  • Avatar
    Greg Dinger

    @Vladimir Chernikov 

    New question please.  The Windows file originally included the following commands which deals with updating the log rotation either by time or by size:
    "%plesk_cli%\domain.exe" -u %%a -log-bytime %value%
    "%plesk_cli%\domain.exe" -u %%a -log-bysize %size%

    What it did not do was to set the variable which influences how many files are to be retained.  

    I went ahead and added this line to force the maximum files to be retained to 25.
    "%plesk_cli%\domain.exe" -u %%a -log-max-num-files 25

    But there's still one more bit.  The script also does not support log compression.  I am looking at this page: 
    https://docs.plesk.com/en-US/obsidian/cli-win/using-command-line-utilities.43564/

    What I find odd is that there is no reference to this domain.exe command.  What I do find is a reference to site.exe:
    https://docs.plesk.com/en-US/obsidian/cli-win/using-command-line-utilities/siteexe-sites.67068/

    In the site.exe section I find a reference to "-log_compress"

    Why is domain.exe not referenced, and dare I use "-log_compress" as a parameter to domain.exe?

     

    0
    Comment actions Permalink
  • Avatar
    Greg Dinger (Edited )

    Edit - I reported initially that the script failed on Win 2012.  Appears that was my fault, I ran again with correct inputs and it's working fine.

    Would really like to see docs for domain.exe

     

    Latest update. 

    - Still hoping to find where domain.exe is declared in the docs.  

    - ran the script with -log_compress on a Windows 2016 server and it worked fine.

     

    0
    Comment actions Permalink
  • Avatar
    Vladimir Chernikov
    Hello @Greg Dinger,
     
    Thank you for your input! 
     
    >> Still hoping to find where domain.exe is declared in the docs.  
     
    It looks that domain.exe utility was replaced by site.exe. I've updated script with site.exe and it is working fine on the test server. 
     
    Additionally, I've updated the script with ability to set log compression and the maximum files to store. Please let me know if you have any additional questions. 
    1
    Comment actions Permalink
  • Avatar
    Del C (Edited )

    > For example, to enable log rotation on the domain example.com once the current log file reaches the 200 KB size (by-size rotation), use the following command:
    > # plesk bin subscription -u example.com -log-bysize 200

    This is wrong! Log-bysize is in MB.

    Tested on Obsidian 18.0.39 Update #2. 

    0
    Comment actions Permalink
  • Avatar
    Vladimir Chernikov
    Hello @Del C,
     
    Thank you for bringing this to our attention!
     
    I've updated the article accordingly.
    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request