Knowledgebase: Shared Hosting
How to disable system logs in Linux
Posted by Modestas J on 21 February 2012 12:20 PM

The ability of Linux systems to back up log files is one of the chief features that make it a very smart operating system.  Log files are very useful especially in troubleshooting problems that you may encounter while working with Linux. They store every activity that you do on your machine. The log files are in form of plain text in a typical format.

In most Linux operating system, you can locate the log file from the subdirectory “/var/log”. The log daemon is the one responsible for generating log files. Conversely, some applications can directly bank their log files to the said sub-directory.

There are numerous types of log files. For instance, Linux generate it own log files without the involvement of other application. These log files have the general term “system log files”. Examples of system log files include systems massages and daemon. Linux creates each system log file independently.

Another type of the log files is the non-human readable log files. These are files that you cannot read and understand them. They are for applications only. The language is very complicated and only understandable to applications.

The storage of log files is however not useful when the disk space is very limited. Linux will continue to store files so long as you do not disable them. Like other files, they occupy space and when they are many the can eat up the available free disk space. When the disk is full, it leads to crushing of the machine. It therefore advisable to delete the log files after sometime or completely disables them. 

The best method to disable this file is to play around with the “logrotate” file. You should modify it so that it can delete the log files on hourly basis.

  1. Transfer “logrotate” file from the daily to hourly rate folder. This ensures that it runs every sixty minutes.
  2. Open the file “logrotate” and modify it by changing the “rotate 4” to rotate 0” and “weekly” to “daily.
  3. Locate the “#compress” line and add “Size 1kb”  and “shred” at its beginning
  4. Locate the line with weekly and monthly and comment it out by adding a hush tag at it beginning
  5. Search for “logrotate.d” and make the same changes. Application use this file to store they files.
  6. Shutdown your machine and start again for changes to take course.
  7. Check out if your changed files are working.

You can deal with excess log files by simply deleting them. You can create a schedule whereby you delete the log files twice a month. If you do not have time for that the above steps will help you since the “logrotate” file configuration are set to delete log files on hourly basis. 

However I recommend that you delete you log files manually after sometime. This will help in case you encounter a system problem that you need to tackle with reference to the log files. When you deleted the log files on hourly basis, you will not have reference point.

The Best Web Hosting

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako Fusion