Our systems run 24/7. Monitoring our systems is done with log-files. In these log-files we gather all necessary information for debugging our software. The log-files contain information about connections, reading data, database or file accessibility  and other processes. Due to the extensive logging of our software there is a high risk of disk space shortage when systems are running for longer periods of time, the disadvantage of extensive logging is the disk-space needed.

Because the log-files are evaluated weekly it is not necessary to store these log-files for ever. We have 2 ways to do our log-file housekeeping, the easiest is presented below. The script shown can be used to truncate a log-file at 50000 lines. (Use any number you find reasonable for the particular log file)


if [ -f ${logfile} ]                                             
        tail -50000 $logfile > $logfile.tmp
        mv $logfile.tmp $logfile
        echo "File $logfile not found"

The second way of limiting log file sizes will be shown in another article. This is in preparation.