BuycPanel Blog

BuycPanel Blog

Latest news and updates

Key Steps to Clean Unmanaged Log Files?

Posted by Allura on 28 10 2019.

Introduction
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 different steps to expeditiously clean or manage the bunch of unmanaged log files.
Step 1: Check Disk Space Usage In Compressing Old Log Files
We all understand that cPanel and WHM helps in making and maintaining log files neatly. The log files allow one to know about the errors and various other vital occurrences on the system.However, in the succeeding amount of your time, the amount of the log files grows to a big massive size exhausting 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 scale back the huge disk space that these log files…

Introduction

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 different steps to expeditiously clean or manage the bunch of unmanaged log files.

Step 1: Check Disk Space Usage In Compressing Old Log Files

We all understand that cPanel and WHM helps in making and maintaining log files neatly. The log files allow one to know about the errors and various other vital occurrences on the system.

However, in the succeeding amount of your time, the amount of the log files grows to a big massive size exhausting 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 scale back the huge disk space that these log files occupy, one ought to compress these log files.

Step 2: Delete Log Files In cPanel

Check The Disk Space From Command Line

  • Be sure to log in to the terminal being the root user.
  • Use du command du -h/var/log/ to see the most space-consumed files and directories inside /var/log
  • The du -h/var/log command prints the evaluated disk space utilized by each file and directory.
  • The -h argument makes the command to print data that may be browsed by us.

Select The Log Files To Clear

We can clear individual files in the directory itself.

  • The /var/log/munin directory makes use of 2.6 G of space being the second-largest log on the list.
  • Use cd command to move them to /var/log/munin
  • Use du -h* command to visualize the amount of the files.
  • du -h command absenting the asterisk logo can show the scale of the directory.

Empty The Files

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

       cat/dev/null > munin-update.log

where,

  • /dev/null is a file that has no existence, with nil 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 previous log files in /usr/local/cpanel/logs/archives/ directory. With the assistance of the actions, one can manage as well as reduce the amount of disk space that the hard drive utilizes.

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 ought to be taken in removing them manually. For help, use rm command to get rid of older log files.

Conclusion

Unmanaged log files are a huge headache in the system’s storage. It must be checked from time to time and cleaned accordingly for a healthy working of the device and system. All data on brushing the unmanaged log files are reviewed in this article.