There are times when you need to find and clear up PHP / WordPress error logs for multiple sites on the same server at once, so you can quickly oversee recurring problems. Running these Linux commands is one of the solutions which could come in handy in such cases.
First you must login into the server via SSH with root privileges.
To find all of the error log files and list them in the console…
Use this command:
find / -type d \( -path "/var/www/vhosts/system" -prune \) -o -type f \( -name "error_log" -o -name "debug.log" -o -name "proxy_error_log" -o -name "php-fpm_error.log" \) -size +0c -exec ls -lh {} \;
To find all of the error log files and empty them…
This will just empty the error log files. They will be left on the system. Use this command:
find / -type d \( -path "/var/www/vhosts/system" -prune \) -o -type f \( -name "error_log" -o -name "debug.log" -o -name "proxy_error_log" -o -name "php-fpm_error.log" \) -size +0c -exec truncate -s 0 {} \;