Pages

Wednesday, April 8, 2015

EM logs configuration changes using WLST Script




Step1:  Create a python script simple txt editor using below script, if we have more number of WLS instance then add more lines similar to below lines for each WLS instance and run the script



username ="'weblogic"
password = "xxxxx"
URL='t3://hostname.domain.com.au:7001'
connect(username,password,URL)
print "Connected successfully with Admin Server"
domainRuntime()

configureLogHandler(target="AdminServer", name="em-log-handler", rotationFrequency="daily", retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/AdminServer/emoms.log", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="AdminServer", name="em-trc-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/AdminServer/emoms.trc", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="AdminServer", name="odl-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/AdminServer/AdminServer-diagnostic.log", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00" )

configureLogHandler(target="AdminServer", name="owsm-message-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/AdminServer/msglogging", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="AdminServer", name="soa-tracking-trc-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/AdminServer/AdminServer-soa-tracking.trc", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")





configureLogHandler(target="WLS_OSB1", name="em-log-handler", rotationFrequency="daily", retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/WLS_OSB1/emoms.log", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="WLS_OSB1", name="em-trc-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/WLS_OSB1/emoms.trc", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="WLS_OSB1", name="odl-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/WLS_OSB1/WLS_OSB1-diagnostic.log", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00" )

configureLogHandler(target="WLS_OSB1", name="owsm-message-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/WLS_OSB1/msglogging", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")

configureLogHandler(target="WLS_OSB1", name="soa-tracking-trc-handler", rotationFrequency="daily",retentionPeriod="month", path="/u01/app/oracle/admin/domain/cluster/logs/WLS_OSB1/WLS_OSB1-soa-tracking.trc", removeProperty=['maxFileSize','maxLogSize'], baseRotationTime="2015-03-26T01:00")



Step2: Run the script e.g 

/u01/app/oracle/product/fmw/Oracle_SOA1/common/bin/wlst.sh /scripts/changLogConfiguration/ChangeEMLogFileSize.py

Step3: 

Verify the EM logs from EM console 




Note:  For Detailed list of available options and property, go through below links and modify the script as per your requirement. 

http://docs.oracle.com/cd/E28271_01/web.1111/e13813/custom_logging.htm
http://docs.oracle.com/cd/E29542_01/core.1111/e10105/logs.htm#ASADM217

Also, make sure the wlst.sh which you use it must be located from Oracle_SOA1 home.

There could be possibilty that while running above script you may hit error message such as "maxFileSize" property does not exist etc because there could be some handler files which does not have size based default configuration.

Unfortunately I didn't find any simple way to ignore such error, to avoid that what I did, I first ran another script which set the size based configuration and then I ran above script which set time based rotation configuration 


configureLogHandler(target="AdminServer", name="em-log-handler", maxFileSize="10", maxLogSize="10")
configureLogHandler(target="AdminServer", name="em-trc-handler", maxFileSize="10", maxLogSize="10")
configureLogHandler(target="AdminServer", name="odl-handler",  maxFileSize="10", maxLogSize="10")
configureLogHandler(target="AdminServer", name="owsm-message-handler", maxFileSize="10", maxLogSize="10")
configureLogHandler(target="AdminServer", name="soa-tracking-trc-handler", maxFileSize="10", maxLogSize="10")








No comments:

Post a Comment