Red Hat OpenShift WorldTour
  • Red Hat OpenShift Workshop
  • Accessing IBM Cloud - the Free Lite Account
  • Lab 1 - Start with a Docker Image
  • Command Line Interface - Using the CLI in a Terminal
  • Claiming Your Red Hat OpenShift Cluster for This Workshop
  • Pre-Requesites Lab 2
  • Lab 2 - Using an existing image to create a project
  • Lab 3 - stretch goal
  • Lab 3 with LogDNA
  • Next Steps
    • IBM/minishift101 - step 1 - accessing cluster
    • IBM/minishift101 - step 2 - creating an app from source
    • IBM/minishift101 - step 3
    • IBM/minishift101 - step 4 networking
  • How Did You Like This Workshop?
  • FAQ
    • Lab 2 v 3.x - Using an existing image to create a project
    • Lab 3 - Deploying a Project to Red Hat OpenShift Kubernetes Cluster
      • Lab 3 - setting up
      • Lab 3 - instructions on creating an OpenShift project
Powered by GitBook
On this page
  • Step 1 - Create a LogDNA service
  • Step 2 - Use LogDNA

Was this helpful?

Lab 3 with LogDNA

PreviousLab 3 - stretch goalNextNext Steps

Last updated 5 years ago

Was this helpful?

A cloud native application based on microservices contains many parts that create logs. A logging service that is able to collect all distributed logs in one place is a highly recommended tool. There are many logging solutions that you can install directly into your Kubernetes or OpenShift cluster. But then you have an additional application that needs to be maintained and one that needs persistent storage as well to store logs for a period of time.

IBM Cloud offers "Logging as a Service" in the form of . It offers features to filter, search, and tail log data, define alerts, and design custom views to monitor application and system logs. You can test "IBM Log Analysis with LogDNA" for free with somewhat limited capabilities and we will show you in this lab how to connect your OpenShift cluster to an instance of it.

Official documentation for setting up the LogDNA agent for an OpenShift cluster is .

For the following instructions use the IBM Cloud Shell to enter the commands.

Step 1 - Create a LogDNA service

  1. In your browser log in to the IBM Cloud dashboard

    • Make sure you are using your own account.

    • From the "burger menu" select "Observability"

  2. Create an "IBM Log Analysis with LogDNA" instance

    • Select "Logging" on the left

    • Click "Create a logging instance"

    • Leave the default name or choose your own ("logdna-openshift")

  3. In the next dialog:

    • Select a region close to your OpenShift cluster

    • Leave the "Lite" pricing plan but take note of the other plans; those are the full featured plans. But you need a paid account to use those. We will use Lite for this lab.

    • Scroll down a bit

    • Leave the service name and the "Default" resource group

    • Click "Create" at the bottom of the dialog.

  4. Click on "Edit log sources"

  5. Select the "OpenShift" tab. Copy, paste, and execute the commands into your IBM Cloud Shell:

  6. Check that the logging agent is running with:

    $ oc get all -n ibm-observe

Step 2 - Use LogDNA

  1. Go back to the IBM Cloud Dashboard

  2. From the Burger menu in the upper left corner select "Observability"

  3. In the Observability menu select "Logging"

  4. Click on "View LogDNA"

    This will open the LogDNA dashboard.

  5. $ oc project <your project>
    $ watch curl -X GET "http://$(oc get route authors-bin -o jsonpath={.spec.host})/api/v1/getauthor?name=Niklas%20Heidloff" -H "accept: application/json"

    The "watch" command will constantly (every 2 seconds) request author information.

  6. Refresh your browser tab with the LogDNA dashboard, open the "All Apps" pulldown, and select "authors":

    Note: If you don't see "authors" wait a little longer (with the free/lite version it can take several minutes before data shows up), then refresh the browser tab of the LogDNA dashboard again.

  7. You should now see messages from the authors service alone:

  8. Terminate the command from step 5 ("watch curl ...")

In Lab 4 "" you have deployed an instance of the authors service. We will check LogDNA for output from this instance. Execute the following commands in the IBM Cloud Shell:

IBM Log Analysis with LogDNA
here
Deploying to OpenShift