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:
- Extract the Liberty beta ZIP file. From the command line, change to the
wlpfolder and run the following command to create a new server called
bin/server create server1
Optionally deploy some applications to the Liberty server.
- 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.
- 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
- For the US South region, run:
- 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"
- Bind the service to
bin/bluemixUtility bind server1 bluemixLog
- 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:
- For the US South region: https://logmet.ng.bluemix.net
- For the United Kingdom region: https://logmet.eu-gb.bluemix.net
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.
Click the Dashboard tab to switch to the Dashboard view:
You’ll see the following dashboards:
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:
In my screen shot, there are three tables at the top of the dashboard:
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:
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:
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
liberty_ffdcGraph displays the number of FFDCs generated over time.
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.
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.
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.