BuycPanel Blog

BuycPanel Blog

Latest news and updates

Clean Unmanaged Log Files

Posted by Allura on 18 07 2018.

A Brief Introduction In Cleaning Unmanaged Log Files

Sometimes we are not able to manage or reduce the size of the file with the help WHM’s cPanel Log Rotation Configuration interface (WHM >> Home >> Service Configuration >> cPanel Log Rotation Configuration). So, there are other steps to efficiently clean or manage the bunch of unmanaged log files.

 

Step 1:

Check Disk Space Usage In Compressing Old Log Files

We all know that cPanel and WHM helps in creating and maintaining log files smartly. What the log files actually does is- it allows one to get acknowledged about the errors and other significant occurrences on the system.

However, after certain period of time, the size of the log files grow to a significant large size consuming the system’s storage devices. Though cPanel and WHM archive the files with cpanellogd daemon, but, this daemon is not that capable to archive all log files. Hence, to reduce the extreme disk space that these log files occupy, one should compress these log files.

 

Step 2:

Delete Log Files In cPanel

Check The Disk Space From Command Line

  • Ensure login in to the terminal as the root user.

Use du command du -h/var/log/ to see the most space-consumed files and directories inside /var/log

  • du -h/var/log command prints the evaluated disk space consumed by each file and directory.
  • The -h argument makes the command to print information that can be read by us.

Select The Log Files To Clear

We can clear individual files in directory itself.

  • The /var/log/munin directory uses 2.6 G of space which is the second largest log on the list.
  • Use cd command to move them to /var/log/munin
  • Use du -h* command to see the size of the files.
  • du -h command without asterisk symbol will show the size of the directory.

Empty The Files

Empty the log files and directory by using cat command (concatenate).

cat/dev/null > munin-update.log

where,

  • /dev/null is a non-existing file with zero information.
  • When one concatenate /dev/null to a log file to empty file data, it empties the data but does not delete the file name.
  • To confirm its successful empty, use

du -h* command.

 

Step 3:

Log Rotation

The log rotation system of cPanel and WHM compresses and stores the old log files in /usr/local/cpanel/logs/archives/ directory. With the help of these actions, one can manage as well as reduce the amount of disk space that the hard drive utilises.

With the help of WHM’s cPanel Log Rotation Configuration interface, one can enable and configure log rotation (WHM >> Home >> Service Configuration >> cPanel Log Rotation Configuration). This system stores archive log files in abundance. So, care should be taken in removing them manually. For help, use rm command to remove older log files.

Conclusion

Unmanaged log files are a big burden in system’s storage. It must be checked from time to time and cleaned accordingly for a healthy working of the device and system.