Informix Log Files

Informix is quite capable of chewing up all of the disk space it can find with transaction log files, if you let it. A common technique to circumvent this situation is to copy /dev/null to each log file on a daily or weekly basis (this technique can be employed for a test system). Another technique is to rotate the log files, keeping only a certain number and deleting older files after a certain time interval has elapsed (this technique can be used for a production system). Keeping log files for a reasonable length of time will allow debugging of transactions, should the need arise to determine when a problem occurred.

If your database is used only during certain hours of the day, the users will see no effect if log file management is done regularly at off-peak times. This allows a daily cron job to clear or rotate the log files with no noticable impact.

If you have a test database, where you don't care about log files, set up the cron table (/etc/crontab) or set up a daily script (in /etc/cron.daily) to clear the log files for all transaction logs for all databases that are in use (sample crontab entry shown):

     05 2 * *  root /usr/bin/find /home/coll/colldev -name \.log \
                     -exec cp /dev/null \{\} \;

For a production system, where you'd like to keep a few revisions of the log, a logrotate file should be added to /etc/logrotate.d/dbname that looks like this one. It will rotate the main database transaction log weekly, keeping 60 weeks worth of log files, compressing the rotated copies and then zero out any other log files that happen to be present. Only the main transaction log is really important.

     /home/coll/collprod/coll.log {
         weekly
         rotate 60
         notifempty
         missingok
         compress
         create 0660 coll informix
         copytruncate
         postrotate
             /usr/bin/find /home/coll/collprod -name \*.log \
                 -exec cp /dev/null \{\} \;
         endscript
     }