In most Linux distributions, a utility called logrotate is installed by default. Logrotate does just what the name implies: it will rotate the logs of your desired application. Rotating a log means, copy the log to another location so you don’t have a massive log file to sift through.
You can rotate the logs with a myriad of criteria. If you want to rotate the log everyday, you can. If you only want to rotate the log if the log reaches a megabyte (1MB), you can.
Logrotate is most commonly executed from the cron. Specifically, it will be called by a daily cron job (/etc/cron.daily). You can have it run hourly or whenever you want to handle the ASE errorlog.
/etc/logrotate.d/sybase_ase
/dbms/sybase/ASE-12_5/install/*.log { rotate 10 copytruncate compress size 1M }
logrotate all of the log files ending in “.log” in this directory
/dbms/sybase/ASE-12_5/install/*.log
keep the last 10 rotated log files (myserver.log.1, myserver.log.2, etc)
rotate 10
we need to copy the log, then truncate the log because none of Sybase’s servers support attaching to a new log file without restarting the entire application.
copytruncate
we want to compress the log rotated files because they can be rather large (say if ASE barfs and puts 100 MBytes in the log). gzip is used by default
compress
we want to rotate the log files when the files reach 1 MByte.
size 1M