July 14, 2015

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:
/usr/local/apache/logs/access_log
/usr/local/apache/logs/error_log
Exim (Email) Logs:
/var/log/exim_mainlog
/var/log/exim_paniclog
/var/log/exim_rejectlog
Ftp Logs:
/var/log/messages
Mysql Logs:
/var/lib/mysql/server.hostname.err
Cronjob Logs:
/var/log/cron
Server Logs:
/var/log/messages
SSH Logs:
/var/log/secure
cPanel Installation Logs:
/var/log/cpanel-install-thread0.log
ChkServd (cPanel Monitoring Daemon) Logs:
/var/log/chkservd.log
Named (Bind) Logs:
/var/log/messages
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:
/usr/local/apache/domlogs/domainname.tld
Mod Security Logs:
/usr/local/apache/logs/modsec_audit.log
/usr/local/apache/logs/modsec_debug_log
Apache SUEXEC Logs:
/usr/local/apache/logs/suexec_log
cPanel Access and Error Logs:
/usr/local/cpanel/logs/access_log
/usr/local/cpanel/logs/error_log
Stats Execution Logs:
/usr/local/cpanel/logs/stats_log
cPanel License Logs:
/usr/local/cpanel/logs/license_log
cPanel Backup Logs:
/usr/local/cpanel/logs/cpbackup/*.log
Tomcat Logs:
/usr/local/jakarta/tomcat/logs/catalina.err
/usr/local/jakarta/tomcat/logs/catalina.out

Related Posts:

  • Các lệnh autofix dành cho cPanel/WHM Một số lệnh autofix giúp bạn có thể thực hiện các tác vụ trên hệ thống trong nhiều trường hợp, chẳng hạn như đổi SSH port và quên mất, hay bạn block nhầm chính IP mình đang truy cập trên cổng FTP chẳng hạn. Flushing iptable… Read More
  • 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… Read More
  • Disk Space for MySQL Databases in cPanel Show as 0MB When you upgrade from cPanel 11.24 to 11.25, your users may notice that in cPanel, their MySQL databases show 0MB of disk space used, when they know their databases are much larger. This is due to an option in cPanel that yo… Read More
  • 5 Ways to Get a User’s Disk Usage This may seem pretty simple, but I see a lot of questions about how to get a user’s disk space usage on a cPanel user. I put together a quick list of 5 simple ways for the average admin:  1) Good ole’ cPanel/WHM. You c… Read More
  • How to Clean Log Files Before You Enable Log Rotation Checking disk space usage and removing old log files cPanel & WHM create and maintain log files. These log files allow you to examine errors and other occurrences on the system. After an extended period of time, the sy… Read More

0 comments:

Post a Comment