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:

  • Hướng dẫn tăng tốc website bằng tính năng nén trên cPanelĐây là bài viết hướng dẫn tăng tốc độ load website, một tính năng có sẵn trên cPanel. Với việc website được nén lại sẽ nhẹ hơn, load nhanh hơn, giúp tối ưu hóa website tốt hơn trên bộ máy tìm kiếm.Bước 01: Bạn cần đ… Read More
  • Hướng dẫn sử dụng easyapache thông qua command line 1. Giới thiệu:Công cụ easyapache cho phép cài đặt, điều chỉnh, thiết lập các thành phần của PHP và Apache cho WHM và cPanel.Khách hàng có thể sử dụng công cụ này thông qua giao diện hoặc command line. Khi sử dụng phiên … Read More
  • NHỮNG LỆNH COMMAND HỮU ÍCH TRÊN CPANEL/WHM Bên dưới đây là các lệnh command tự động sửa lỗi hệ thống rất hữu dụng. Giả sử như các thao tác trên SSH có lỗi nào đó xảy ra, thì các command bên dưới sẽ sửa được các lỗi đó. Thay yourdomain.com thành tên miền của bạn, khi … Read More
  • Hướng dẫn fix lỗi Data Error khi truy cập File Manager trong cpanel Đã bao giờ bạn truy cập File Manager trong cpanel để quản lý file,nhưng bạn không thấy bất kỳ 1 file nào ngoài thông báo  “Data Error” ?Lỗi không hiển thị file trong  File Manager như trên vì lý do nào đó,bạn … Read More
  • Backup all cpanel accounts UPDATE: The one-liner below still works as of 7/23/15 on CENTOS 5.8 x86_64 WHM 11.50.0 (build 27). Will be testing shortly on CENT7 To create all accounts backup on your server, execute following command  for backup … Read More

0 comments:

Post a Comment