Register

Closed Thread

Junior Member

Join Date: Aug 2007
Posts: 26
 
12-07-2007, 01:57 PM
Default Save disk space by rotating older log files

When it comes to the files taking up space on your server, they fall into two general categories:
  • Constant files (Linux OS, control panel). These files don't change much in size over time.
  • Variable files (websites, email, logs). These files can vary widely in size as time goes by.

Website code is completely under your control, depending on what you post, and email can be deleted off your server as you see fit. Therefore, this will focus on the third variable file area: log files. Logs can grow to be quite large, especially if there is an errant process throwing tons of error messages, and theoretically large enough log files could fill up all the available disk space on your VPS. (Note: I have yet to see this actually happen, but it's definitely possible!)

The main file controlling log rotation is /etc/logrotate.conf. Default settings will rotate all files weekly (as <file>.1, <file>.2, and so on), and keep up to 4 backup files (deleting the oldest in order). One setting you should definitely change is to enable compression:
- Edit /etc/logrotate.conf
- Uncomment the '#compress' line by removing the '#' from the beginning of the line, and save the file.

Additional log rotation control files for different services are found under /etc/logrotate.d/, and named by service. For instance, in /etc/logrotate.d/exim, you will find one section for each exim logfile (exim_mainlog, exim_paniclog, and exim_rejectlog). Each of these files can contain options that will override the equivalent option in logrotate.conf; for instance, if you find that you need to rotate the exim logs daily instead of weekly because of huge spam volumes.

For more options and information, see the man page for the logrotate daemon itself:
-bash-3.00# man logrotate
MikeS is offline
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 09:00 PM. Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 VBulletin Skin by ForumMonkeys.