Skip to main contentIBM Cloud Patterns

Configuring Logging for VSI

Provision IBM Log Analysis with LogDNA for Virtual Server Instance(VSI)

In this section, we will see how to send application logs on VSIs to LogDNA for analysis. In order to demonstrate the feature, we will do the following:

  • Create an instance VSI with Ubuntu image on VPC
  • Deploy a WAS liberty server and deploy a sample J2EE application
  • Install and configure LogDNA agent
  • Visualize the logs on LogDNA Dashboard on IBM Cloud

We will also cover some aspect of auto-scaling and how you can setup for proper filtering of logs from each of the instance.

Create VSI Instance

Click here to create an instance of Virtual Private Cloud. Please configure as shown below, and click Create Virtual Private Cloud

Create VPC

Click here to create an instance of Virtual Server. Please configure as shown below, and click Create Virtual Server Instance.


Please refer the link to create SSH keys.

Create VSI

Reserve IP:

Click on Reserve IP to bind to a Floating IP. Reserve IP

Deploy an application

Login to VSI using SSH and deploy the application as shown below.

ssh -i [path to private key file] root@[Floating IP address]
chmod +x install-script

Install and configure LogDNA

On the LogDNA Dashboard, click on Edit log sources. Log sources

On the Add agents to desired log sources page, select the Linux Ubuntu/Debian tab. Run the commands displayed with the below changes.

  • For “/var/log is monitored/added by default (recursively), optionally add more dirs with”, run the below command
sudo logdna-agent -d /root/wlp/usr/servers/defaultServer/logs/
  • For “You can configure the agent to tag your hosts with”, run the below command:
sudo logdna-agent -t $HOSTNAME

The script below needs to be included in the “User Data” section of the “Instance Template” for auto scale configuration. This will ensure the new VSI instance is attached to the same logDNA instance.

Log commands

Visualize Logs

Click on View LogDNA after all the commands run fine.

The logs can then be viewed on the LogDNA Dashboard: Dashboard