Skip Navigation Links | |
Exit Print View | |
Sun QFS and Sun Storage Archive Manager 5.3 Reference Manual Sun QFS and Sun Storage Archive Manager 5.3 Information Library |
1. User Commands (Man Pages Section 1)
2. Maintenance Commands (Man Pages Section 1M)
3. Library Functions (Man Pages Section 3)
4. Library Functions (Man Pages Section 3X)
5. File Formats (Man Pages Section 4)
NAME log_rotate.sh - Rotates log files SYNOPSIS /opt/SUNWsamfs/examples/log_rotate.sh file [ minsize ] AVAILABILITY SUNWsamfs DESCRIPTION The log_rotate.sh script rotates log files generated by Sun Storage Archive Manager (SAM-QFS) environments and other programs. The process of rotating log files assumes that you want to keep no more than seven generations of a file in your directories at one time. If the size of file is minsize or greater, the files are rotated. When the files are rotated, the newest file is renamed file.1, the next-newest file is renamed file.2, and so on. The oldest file in the directory is deleted as new ones are added, so the oldest file in the directory at any time is always called file.7. This process provides the following benefits: o A given file never becomes so large that it is unwieldy to copy or view. o Entries are expired after a period of time. This prevents file systems from filling up due to the volume of log entries. You should send a HUP signal to syslogd after rotating the SAM-QFS log file to make syslogd close and reopen the file in its new location. This is not necessary for files created by SAM-QFS processes because they check to see if the file has been changed whenever it is opened. The following are some of the SAM-QFS files you should consider rotating: File Name or Type Location SAM-QFS log file See /etc/syslog.conf for location. /devlog files /var/opt/SUNWsamfs/devlog/. Stage log files See /etc/opt/SUNWsamfs/stager.cmd for location. Releaser log files See /etc/opt/SUNWsamfs/releaser.cmd for location. Recycler log files See /etc/opt/SUNWsamfs/recycler.cmd for location. SEF data files /var/opt/SUNWsamfs/sef/sefdata. Note that the information in the archiver log is valuable and should be preserved. It should not be discarded after a short period of time. OPTIONS This script accepts the following arguments: file The log file to be rotated. For example, sam-log. minsize Specify an integer number, in bytes, that represents the minimum size of the log file to be rotated. Log files smaller than this minimum are not rotated. The default minsize is 100000. To enable this script, copy it from /opt/SUNWsamfs/examples/log_rotate.sh to /opt/SUNWsamfs/scripts/log_rotate.sh, modify it to take the desired action for your installation, and set up a crontab(1) entry to run the log_rotate.sh script. EXAMPLES The examples that follow assume that you have copied the script from its location in /opt/SUNWsamfs/examples/log_rotate.sh to /opt/SUNWsamfs/scripts/log_rotate.sh. Example 1. Assume that you want to set up a crontab(1) entry to run the log_rotate.sh script at a desired interval for each of the log files you wish to rotate. To rotate file sam-log every week, the entry would appear as follows: 10 3 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh /var/adm/sam-log 20 3 * * 0 /bin/kill -HUP `/bin/cat /etc/syslog.pid` This crontab(1) file rotates the /var/adm/sam-log files every Sunday at 0310. The second line sends a HUP signal to the syslogd daemon to notify it to close the file (which has been moved) and open a new one. Note that this action is only useful for files written by syslogd. Example 2. To rotate file releaser-log every week, the entry would appear as follows: 40 2 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh /var/adm/releaser-log This crontab(1) file rotates the /var/adm/releaser-log files every Sunday at 0240. FILES The log_rotate.sh script resides in the following location: /opt/SUNWsamfs/examples/log_rotate.sh SEE ALSO crontab(1), syslogd(1M).