Tuesday, July 12, 2011

server.out files rotation

I can't claim to have found this solution,one of my colleague hit upon this solution.Here it goes..

Q: Customer says that their server.out files are going upto 4GB causing server performance issues.These are not the diagnostic or log files,as we earlier assumed.But get created under a weblogic domain's managed server's log folder.Customer wanted it to rotate every 20MB.This cannot be controlled from weblogic as we assumed.

Here is how it was solved.

mv /etc/cron.daily/logrotate /etc/cron.hourly/

take backup and open the /etc/logrotate.conf and make changes as given below:

$DOMAIN_HOME/servers/<server-name>/logs/*.out 
{
daily
missingok
copytruncate
rotate 20
size=20Mb
 postrotate
mv  $DOMAIN_HOME/servers/<server-name>/logs/*.out.* $DOMAIN_HOME/servers/<server-name>/logs/archivedlogs
endscript 
    }

substitute domain home with absolute path