How to Delete all logs in a cpanel server - SSH

The command below will delete/empty all files in '/path/to/the/logdirectory' directory.

for i in $(find /path/to/the/logdirectory -type f); do echo > $i; done

You can empty the logs files via SSH as user root using the 'echo' command

echo > /path/to/the/logfile

You should be aware of the list of different log files on a cPanel server.

BTW, why are you looking to delete the log files from your server? If the problem is with the limited disk space, you can always use Log Rotation to rotate the log files in timely manner and delete old logs.

The  path to various logs files on a cPanel server for different services is listed below:
Apache Web Server Logs:
Exim (Email) Logs:
Ftp Logs:
Mysql Logs:
Cronjob Logs:
Server Logs:
SSH Logs:
cPanel Installation Logs:
ChkServd (cPanel Monitoring Daemon) Logs:
Named (Bind) Logs:
Last successful login attempts to the server:
/var/log/wtmp (but to view the details, execute the command “last”)
Last unsuccessful login attempts to the server:
/var/log/utmp (To view the logs, execute “lastb” command)
Domlogs of an Account:
Mod Security Logs:
Apache SUEXEC Logs:
cPanel Access and Error Logs:
Stats Execution Logs:
cPanel License Logs:
cPanel Backup Logs:
Tomcat Logs:
This entry was posted on Sunday, September 27th, 2009 and is filed under cPanel Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Post a Comment