RotateLog

More often than not I run into applications that do not know how to clean up after themselves or their log files. On a couple of my boxes, there are applications that have two years of logs squirreled away, just taking up space. Since the application owners do not seem to care about these logs, and do not seem to have any intention of removing any of these logs, I decided to try rotatelog which I used at my old job.

One of the nice things about rotatelog is its config file. A sample file is shown below. After running "make install" all I needed to do was edit a few paths in the rotatelog script.

 FILES:

  # File  Trigger  Owner:Group  Mode  Compress  Archive_Limit

 # =========================================================

  /var/log/wtmp      1M   root:wheel  664  none  4

 /var/log/wtmpx     4M   root:wheel  644  none  4
/var/log/messages  74K  root:wheel  664  Z     5
/var/log/maillog   60K  root:wheel  664  gz    7

 

 ACTIONS:

 

 # Shell Command :file1,file2,file3 ... fileN
# ==========================================

  rotate1                             : /var/log/wtmp,/var/log/wtmpx

 kill -HUP `cat /var/run/syslog.pid` : /var/log/messages,/var/log/maillog

 

 NOTIFY:

 

 # Person to email rotation notification
# =====================================

Rotatelog installed itself to /usr/local/sbin/rotatelog, and created its config file to /usr/local/etc.

After giving it a test, I then I added it to crontab, and let it rip.
Learn more about rotatelog here

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.