We are leveraging the logrotate linux executable to rotate ASM log files, database alert log files, and listener log files.  With log rotate we have the option to compress the previous version of the log file, keep X amount of copied of the log file, rotate the log file on a hourly/daily/weekly/monthly  intervals, etc.

rac22:/apps/oracle/general/sh

DBATOOLS3 – oracle: cat log_rotate.rac22.ksh
export CONF=/tmp/alertlog.conf
cat <<!! >$CONF
/apps/oracle/diag/rdbms/dbatools/DBATOOLS3/trace/alert_DBATOOLS3.log {
weekly
copytruncate
rotate 4
compress
}
!!
 
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/alert_asm.conf
cat <<!! >$CONF
/apps/oracle/diag/asm/+asm/+ASM3/trace/alert_+ASM3.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/listener.conf
cat <<!! >$CONF
/apps/oracle/diag/tnslsnr/rac22/listener/trace/listener.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/extproc_listener.conf
cat <<!! >$CONF
/apps/oracle/diag/tnslsnr/rac22/extproc_listener/trace/extproc_listener.log {
monthly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
 
export CONF=/tmp/alertlog.conf
cat <<!! >$CONF
/apps/oracle/diag/rdbms/gridrac/GRIDRAC3/trace/alert_GRIDRAC3.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF

Comments are closed