• How to remove domain logs in Plesk from command line

Removing domain logs via a command-line interface (Linux)

Connect to a Plesk server via SSH.

Get the website logs structure:

Note: Subdomain and additional domain logs are located in subfolders, e.g. /var/www/vhosts/example.com/logs/sub.example.com.

ls -l /var/www/vhosts/example.com/logs

...
drwx------ 2 user root 4096 Dec 1 18:24 .
drwx--x--- 5 user psaserv 4096 Dec 1 17:39 ..
-rw-r--r-- 2 root root 132 Dec 1 17:39 access_log
-rw-r--r-- 2 root root 14 Dec 1 18:24 access_log.processed
-rw------- 1 root root 0 Dec 1 18:24 access_log.webstat
-rw-r--r-- 2 root root 0 Dec 1 17:39 access_ssl_log
-rw-r--r-- 2 root root 0 Dec 1 18:24 access_ssl_log.processed
-rw------- 1 root root 0 Dec 1 18:24 access_ssl_log.webstat
-rw-r--r-- 2 root root 1278 Dec 1 18:28 error_log
-rw-r--r-- 2 root root 16 Dec 1 18:28 error_log.gz
-rw-r--r-- 2 root root 0 Dec 1 17:39 proxy_access_log
-rw-r--r-- 2 root root 0 Dec 1 17:39 proxy_access_ssl_log
-rw-r--r-- 2 root root 0 Dec 1 17:39 proxy_error_log

Remove log files: Log files with file extensions .gz, .webstat, .processed can be safely removed:

rm -rf /var/www/vhosts/example.com/logs/error_log.gz

Main website log files (access_log, error_log, access_ssl_log) must be cleared:

Warning: Removing main log files instead of clearing them will lead to incorrect functionality of Apache and nginx.

cat /dev/null >/var/www/vhosts/example.com/logs/error_log

This article was last modified: Jan. 17, 2022, 4:26 p.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top