Question
How to fetch Plesk Action Log using the command line?
Answer
Note: Vote for this feature in our Official Plesk UserVoice channel, as top-voted suggestions are likely to be included in future Plesk versions.
Configuration parameters of the Plesk Action Log are available on Tools & Settings > Action Log, where it is also possible to configure and download the action log for a selected time period.
Plesk saves the user actions in the internal action log stored in the Plesk database. It’s possible to fetch the action log records directly from the database using the following steps:
Click on a section to expand
Plesk for Linux
-
Connect to the server via SSH
-
# curl -LÂ https://plesk.zendesk.com/hc/article_attachments/360017853154/action_log.zip -O
-
Unpack the script:
# unzip action_log.zip
-
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
-
Connect to the server via RDP
-
Switch to PowerShell:
C:> powershell
-
PS C:> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -URI https://plesk.zendesk.com/hc/article_attachments/360017853154/action_log.zip -OutFile action_log.zip
-
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) -
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