Configure log rotation and log purge for different logs generated by Weblogic Servers

29

Jul 2016

Configure log rotation and log purge for different logs generated by Weblogic Servers

Oracle weblogic servers generate different log files during runtime. It is important for the administrators to manage them through consistent log rotation and purge policies so that they don’t fill out file system and cause application outages

 

Admin Server and Manager Logs:

 

Admin Servers and Managed servers typically generate the following log files

 

nohup.out (If you start the admin server or managed servers through command line shell)

xxx.log (xxx is the weblogic server name)

access.log

yyy_domain.log (yyy is your domain name. This log is only created under the admin server)

xxx-diagnostic.log (xxx is the weblogic server name)

xxx.out (xxx is the weblogic server name)

 

  • To set up the log rotation policies for xxx.log, follow the below instructions
    • Login to the administration console
    • Navigate to Environment > servers > xxx > Logging > General and set the below values to set the log size and retention rules (Based on the below rules, your managed server *.log will not take more than 200MB of disk space)

7-28-2016 8-51-49 PM

  • To set up the log rotation policies for access.log, follow the below instructions
    • Login to the administration console
    • Navigate to Environment > servers > xxx > Logging > HTTP and set the below values to set the log size and retention rules (Based on the below rules, your managed server access.log will not take more than 200MB of disk space)

    7-28-2016 9-03-21 PM

 

  • To set up the log rotation policies for yyy_domain.log, follow the below instructions
    • Login to the administration console
    • Navigate to yyy_domain (first link on the menu bar) > Configuration > Logging

7-28-2016 9-20-26 PM

  • To set up the log rotation policies for xxx-diagnostic.log, follow the below instructions
    • Login to the em console (url: http://adminhost:port/em)
    • Expand to Farm_yyy_domain> Weblogic Domain > yyy_domain >xxx(where xxx is your server and if in a cluster then expand on the cluster name and select the server) and right click to go to Logs and Log Configuration and set your log rotation and retention configuration
    • Repeat the steps for every managed server in your domain

7-28-2016 9-29-40 PM

7-28-2016 9-36-12 PM

7-28-2016 9-38-03 PM

* You can select Time Based rotation policy if it suits your environment

  • To set up the log rotation and retention policies for nohup.out and xxx.out files, follow the below steps
    • Unfortunately this can’t be done through the administration console or em console. We will use the logrotate function that is shipped with most of the linux operating systems to set it up.
    • create a file name called logrotate.conf and add the below content (Modify the path to your managed/admin server *.out path and create a similar section for every server in your domain. Also change log rotation to your requirement)

/l01/app/oracle/domains/abc_domain/servers/wls_server1/logs/wls_server?.out

{

missingok

copytruncate

compress

rotate=20

size=20M

}

Here is a sample log rotate configuration of a domain with multiple managed servers

7-28-2016 10-03-18 PM

  • Now that you have the logrotate.conf created, add a crontab entry to run the logrotate script every 15 minutes to check and rotate any log or delete any log based on your rules. See below example on a cron entry

0,15,30,45 * * * * /usr/sbin/logrotate -s $HOME/scripts/stat.txt $HOME/scripts/logrotate.conf

Comments (2)

pavan says:

Hi Bro,
This is pavan !! currently i am working on implementation project!! bascially this is my frist project on weblogic !! i got the requriment from client for for log rotatation pls help in this issue

zion says:

Let me know how we can help. Send me your questions and I can provide you some help

Post Your Thoughts

Your email address will not be published. Required fields are marked *