Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to fetch Plesk Action Log using the command line?
Answer
The Plesk version is 18.0.41 or higher:
- 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
-
Connect to the server via SSH
-
# curl -L https://support.plesk.com/hc/en-us/article_attachments/4415948242834/action_log_115000203794.zip -O
-
Unpack the script:
# unzip action_log_115000203794.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:
CONFIG_TEXT: 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
-
Connect to the server via RDP
-
Switch to PowerShell:
C:\> powershell
-
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
-
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:
CONFIG_TEXT: 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
Comments
6 comments
This article does not seem relevant to Plesk Onyx 17.8 anymore as the table format seems to have changed.
$ action_log.sh
ERROR 1054 (42S22) at line 1: Unknown column 'log_actions.action_id' in 'on clause'
exit status 1
There is no action_id table anymore.
Would be nice to have a log viewer added to plesk cli via something like: plesk bin action_log
Or just logging to a file in /var/log/plesk
Maybe this needs to be added to the uservoice pile of requests. :)
Hello @Ivan, here the requested informations:
Product version: Plesk Onyx 17.8.11 Update #18
Update date: 2018/09/02 03:28
Build date: 2018/08/24 12:47
OS version: CentOS 7.5.1804
mysql Ver 15.1 Distrib 10.2.17-MariaDB, for Linux (x86_64) using readline 5.1
The script file should be corrected, i receive the following error executing ./action_log.sh For Plesk version >= 17.8.11:
[root@****** ~]# ./action_log.sh
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's interface preferences updated",' WHERE descr = 'client_preferences_update'' at line 1
exit status 1
Hello @Gianluca,
I have updated the script to work correctly with quotations in locale parameters.
Please, try running it as per following commands:
Hello @Gianluca,
The error was not reproduced, see the output below. Please, let me know OS version and MariaDB version to reproduce the issue. Is Plesk version 17.8?
# plesk -v
Product version: Plesk Onyx 17.8.11 Update #18
Update date: 2018/09/02 22:48
Build date: 2018/08/24 17:47
OS version: CentOS 7.5.1804
# wget https://support.plesk.com/hc/en-us/article_attachments/360006831994/action_17_8.tar.gz && mv action_17_8.tar.gz action.tar.gz
--2018-09-03 19:21:39-- https://support.plesk.com/hc/en-us/article_attachments/360006831994/action_17_8.tar.gz
...
# tar -zvxf action.tar.gz
action_log.sh
# chmod +x action_log.sh
# ./action_log.sh
# ls action_log.txt
action_log.txt
@Oxilion
Hello!
Thank you for the feedback and the idea.
I have created this feature suggestion.
Plesk 17.8 is not released yet and some of the current articles do not support it.
Please sign in to leave a comment.