Monitoring a large environment of Liberty servers can be challenging. Liberty provides a beta feature that can send log records into the Bluemix log collection service. Administrators can monitor and analyze log records from a large number of Liberty servers with the Kibana graphical user interface on Bluemix.

Don Bourne announced the new Kibana 4 dashboards for the Liberty beta in his November 2016 blog post Using Elasticsearch, Logstash, and Kibana with Liberty and WAS traditional. There are three new Kibana 4 dashboards on Bluemix log collection beta. This article describes the dashboards and how to use them.

Set up the Bluemix log collector in Liberty

First, download the latest Liberty beta. The Bluemix log collection service is only supported in beta versions of Liberty at this moment. Use the IBM Java SDK V8 to run Liberty if you want to collect garbage collection data from the JVM.

To set up the Bluemix log collector:

  1. Extract the Liberty beta ZIP file. From the command line, change to the wlp folder and run the following command to create a new server called server1:
    bin/server create server1

    Optionally deploy some applications to the Liberty server.

  2. Sign up for a Bluemix account and create your organization and space. The Bluemix log collection service is available in the US South and United Kingdom regions only.

  3. Authenticate your Bluemix account from Liberty:
    • For the US South region, run:
      bin/bluemixUtility login --api=https://api.ng.bluemix.net
    • For the United Kingdom region, run:
      bin/bluemixUtility login --api=https://api.eu-gb.bluemix.net
  4. Import the server configuration snippet from Bluemix and publish dashboards to the Bluemix log collection service:
    bin/bluemixUtility import bluemixLog --pdashboard=true --psource="message,trace,garbageCollection,ffdc,accessLog"
  5. Bind the service to server1:
    bin/bluemixUtility bind server1 bluemixLog
  6. Finally, start the server:
    bin/server start server1

For more detailed instructions, see the Knowledge Center.

Access Kibana 4 on the Bluemix log collection service

To access Kibana 4 on the Bluemix log collection service, open the log collection service in a browser:

When prompted, enter your IBM ID and Grafana is displayed by default. To switch to Kibana 4, click the Kibana 4 tab in the header.

If you have more than one organization or space in Bluemix, you need to switch to the organization and space that you selected when you ran the bluemixUtility login command. To switch the organization and space, click the user ID on the top right corner, then select the organization and space from the menu.


screen-shot-2016-11-30-at-4-57-58-pm

Click the Dashboard tab to switch to the Dashboard view:


screen-shot-2016-11-30-at-5-01-47-pm

The Liberty dashboards were published by the bluemixUtility import command you ran earlier. To see the list of dashboards, click the “Load Saved Dashboard” icon:

screen-shot-2016-11-30-at-5-04-43-pm

You’ll see the following dashboards:

Liberty-Memory-K4-20161109
Liberty-Problems-K4-20161109
Liberty-Traffic-K4-20161109

The date suffix denotes when these dashboards were created so yours will have similar names but with different dates.

The Problems dashboard

Click Liberty-Problems-K4-20161109 to display the Problems dashboard:


screen-shot-2016-11-30-at-5-44-19-pm

In my screen shot, there are three tables at the top of the dashboard: liberty_hostTable, liberty_userDirsTable, and liberty_serversTable. If you are sending logs from more than one host and/or server, you can click an entry to filter the log records for the specific host or server.

If you see the message Could not locate that index-pattern-field(id: …), you can click Settings > Indices then click the index pattern [logstash-xxxxx…]. Click the refresh icon to refresh the index:


screen-shot-2016-11-30-at-6-18-50-pm

The liberty_topMessageIds graph displays the messages from the timespan selected in the top-right corner of the dashboard, broken out by message ID. You can hover over the bar to see the message count:


screen-shot-2016-11-30-at-5-45-13-pm

Scroll down the dashboard to see the liberty_messageGraph which displays the number of messages found in messages.log over time. The liberty_traceGraph displays the number of trace messages found in trace.log. Trace is not enabled by default. Sending trace to the Bluemix log collection service is usually not done becuase, when trace is enabled, a very high number of trace records can be generated in a short period of time. To enable trace, add a trace specification to the server.xml. The liberty_ffdcGraph displays the number of FFDCs generated over time.

The liberty_messageSearch table displays the messages from the messages.log in the specified time range. You can see the details by clicking the twisty icon at the beginning of the line.

In each of the graphs above, click and drag on the graph to zoom in to a narrower time range.

The Memory dashboard

In the Memory dashboard, you can see the garbage collection duration and heap usage. The duration numbers are in microseconds. Liberty can only collect this data when running with an IBM SDK.


screen-shot-2016-11-30-at-5-58-38-pm

The Traffic dashboard

In the Traffic dashboard, you can see statistics of your applications such as most visited URLs, average response time, slowest URLs, and so on. The elapsed time is in microseconds. The access logging information is not enabled by default. To enable access logging, follow the instructions in the Knowledge Center.


screen-shot-2016-11-30-at-6-20-18-pm

The timespan selection in the top-right corner is limited to 24 hours at the moment. If you encounter an Authorization Exception (I know this is kind of misleading), try to shorten your timespan selection.

Give it a try and let us know what you think in the comments below. If you have any questions, ask on StackOverflow.

Join The Discussion

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