Tuesday, May 23, 2017

Using logrorate in linux for oracle listener and alert logs

Do the following as root user

cd /etc/logrotate.d

vi oracle_listener

/u01/app/11.2.0.4/grid/log/diag/tnslsnr/nasipexadb01/listener_scan3/trace/listener_scan3.log {
weekly
copytruncate
rotate 4
compress
}
/u01/app/11.2.0.4/grid/log/diag/tnslsnr/nasipexadb01/listener_scan2/trace/listener_scan2.log {
weekly
copytruncate
rotate 4
compress
}
/u01/app/11.2.0.4/grid/log/diag/tnslsnr/nasipexadb01/listener_scan1/trace/listener_scan1.log {
weekly
copytruncate
rotate 4
compress
}
/u01/app/oracle/diag/tnslsnr/nasipexadb01/listener/trace/listener.log {
weekly
copytruncate
rotate 4
compress
}


Refer logrorate manpage for more info on parameters.

The above does copy the log file to a diff name and zip it, then truncates the original files.

Rotation will be done weekly and 4 copies will be retained.

If you want to force rotation immediate run the below command

logrotate -f oracle_listener


Note: You may change permissions on the file to 777 just in case if you dont want to ask sys admin every time you want to edit the file

No comments:

Post a Comment

Featured Post

Apply Patch 22191577 latest GI PSU to RAC and DB homes using Opatch auto or manual steps

Patch 22191577: GRID INFRASTRUCTURE PATCH SET UPDATE 11.2.0.4.160119 (JAN2016) Unzip the patch 22191577 Unzip latest Opatch Version in or...