miércoles, 9 de diciembre de 2015

Rotating the STDOUT logfile Weblogic 12c Linux - Crontab

1. Verify that the logrotate tool is installed. Run the following command with root credentials:
which logrotate
2. Create a logrotate.conf file. Add the following lines:
/{logs_route}/managed_server1.out {
missingok
copytruncate
compress
rotate=150
size=200M
}
Note: Files rotate every 200 MB and will be stored the last 150 files. Additionally, each file will be compressed to rotate consecutively.

3. Create a  logrotate.status file. Add the following lines:
logrotate state -- version 2
"/{logs_route}/managed_server1.out" 2015-12-9
4. Create the scheduled task in the crontab file, that runs every 15 minutes every day:
0,15,30,45 * * * * /usr/sbin/logrotate -s /{directory}/logrotate.status /{directory}/logrotate.conf 
5. Final result:
managed_server1.out.6.gz
managed_server1.out.5.gz
managed_server1.out.4.gz
managed_server1.out.3.gz
managed_server1.out.2.gz
managed_server1.out.1.gz