Plesk

How to fetch Plesk Action Log using the command line?

Question

How to fetch Plesk Action Log using the command line?

Answer

The Plesk version is 18.0.41 or higher:

  1. Connect to the server via SSH / RDP

  2. Execute the next command:

    # plesk bin action-log --show -since 2022-01-01 -until 2022-01-05

    Note: in this case, the action logs from 1 January 2022, until 5 January 2022, are fetched.

The Plesk version is lower than 18.0.41:

Click on a section to expand

Plesk for Linux

  1. Connect to the server via SSH

  2. Download the script:

    # curl -L https://support.plesk.com/hc/en-us/article_attachments/4415948242834/action_log_115000203794.zip -O

  3. Unpack the script:

    # unzip action_log_115000203794.zip

  4. Execute the script:

    Note: The following command will return the Action Log records from 1st January 2020 to 30th January 2020 and the output will be saved in the file action_log. For more options run the script with the -h flag: plesk php ./action_log.php -h

    # plesk php ./action_log.php -f 01-01-2020 -t 30-01-2020 -o action_log

    If the following error is shown:

    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 9437473 bytes) in action_log.php on line 327

    Run the command with custom memory_limit parameter, as an example:

    # plesk php -d memory_limit=512M ./action_log.php -f 01-01-2020 -t 30-01-2020 -o action_log

Plesk for Windows

  1. Connect to the server via RDP

  2. Start a command prompt as Administrator

  3. Switch to PowerShell:

    C:> powershell

  4. Download the script:

    PS C:> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -URI https://support.plesk.com/hc/en-us/article_attachments/4415948242834/action_log_115000203794.zip -OutFile action_log.zip

  5. Unpack the script:

    PS C:> Add-Type -Assembly "System.IO.Compression.FileSystem"
    PS C:> [System.IO.Compression.ZipFile]::ExtractToDirectory(($pwd).path + "action_log.zip", ($pwd).path)

  6. Execute the script:

    Note: The following command is valid for PowerShell and CMD. It will return the Action Log records from 1st January 2020 to 30th January 2020 and the output will be saved in the file action_log. For more options run the script with the -h flag: plesk php ./action_log.php -h

    PS C:> plesk php .action_log.php -f 01-01-2020 -t 30-01-2020 -o action_log.txt

    If the following error is shown:

    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 9437473 bytes) in action_log.php on line 327

    Run the command with custom memory_limit parameter, as an example:

    PS C:> plesk php -d memory_limit=512M .action_log.php -f 01-01-2020 -t 30-01-2020 -o action_log.txt

Exit mobile version