Access WebLogic LogFiles with the RESTful Management Interface

At some expert panel a fortnight ago it was discussed how nice it would be to access the WebLogic logfiles via a simple REST request. Here is how it works:

 

Configuration

Enable the RESTful management interface in WebLogic under DOMAIN / Configuration / General / Advanced. It’s a non-dynamic change, so restart the admin server.

Screen Shot 2015-04-07 at 15.20.50

 

Access Log Files

Once the RESTful management is enabled simply use your preferred REST client. One possibility is to use the browser either by typing the URI directly and submitting a GET request. Yet a REST plugin as shown below might be the more comfortable option:

Screen Shot 2015-04-07 at 15.28.23 Screen Shot 2015-04-07 at 15.28.47

For the URI make sure to use host:port of the admin server.
On the response view simply click on the log file that interests you.

Alternatively you can use the UNIX command-line curl:

$ curl --user weblogic:welcome1  -X GET http://localhost:7001/management/wls/latest/servers/id/AdminServer/logs/id/ServerLog

Which URI?

Use the correct SERVER_NAME, e.g. AdminServer in the URI management/wls/latest/servers/id/SERVER_NAME/logs/id/HTTPAccessLog
and replace HTTPAccessLog with the log file you are interested in, such as DataSourceLogDomainLogServerLog.

 

More?

I explained the benefits of using REST for operations in a previous article which also contains a reference to a 2 minute tech tip recorded by OTN.

Make sure to browse the official Oracle WebLogic documentation here.

 

Speak Your Mind

*