DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Knative Log Analysis With LogDNA on IBM Cloud

Knative Log Analysis With LogDNA on IBM Cloud

Check out how you can track the activity going on within your cluster using IBM Log Analysis and Knative.

Vidyasagar Machupalli user avatar by
Vidyasagar Machupalli
CORE ·
Jan. 31, 19 · Tutorial
Like (4)
Save
Tweet
Share
8.11K Views

Join the DZone community and get the full member experience.

Join For Free

In this post, you will learn how to use the IBM Log Analysis with LogDNA service to configure cluster-level logging for an app named "Knative-node-app" published in IBM Cloud Kubernetes Service. Refer to this post to set up a Node.js app.

IBM Log Analysis with LogDNA offers administrators, DevOps teams, and developers advanced features to filter, search, and tail log data, define alerts, and design custom views to monitor application and system logs.

From the moment you provision a cluster with IBM Cloud Kubernetes Service, you want to know what is happening inside the cluster. You need to access logs to troubleshoot problems and pre-empt issues. At any time, you want to have access to different types of logs such as worker logs, pod logs, app logs, or network logs. In addition, you want to monitor different sources of log data in your Kubernetes cluster. Therefore, your ability to manage and access log records from any of these sources is critical. Your success in managing and monitoring logs depends on how you configure the logging capabilities for your Kubernetes platform.

Provision and Configure an IBM Log Analysis with LogDNA

Before provisioning the instance, check the prerequisites.

Once you have the app running on the Knative Kubernetes Cluster, provision an instance of the IBM Log Analysis with LogDNA service:

  • Choose a region/location (us-south)
  • Select a resource group
  • Select an appropriate plan (7-day Log Search is recommended for this post)
  • Click create. With this step, you configure a centralized log management system where log data is hosted on IBM Cloud.

Configure Your Kubernetes Cluster to Send Logs to Your LogDNA Instance

  • Once the service is provisioned under https://cloud.ibm.com/observe/logging, click on Edit log sources and then click Kubernetes.
Observability on IBM Cloud


  • You should see two commands to automatically install a logdna-agent pod on each node of your cluster.
kubectl create secret generic logdna-agent-key --from-literal=logdna-agent-key=<INGESTION_KEY>  


kubectl create -f https://repo.logdna.com/ibm/prod/logdna-agent-ds-us-south.yaml


  • This configures the LogDNA agent on every worker (node) in a cluster.
LogDNA agent on K8s Cluster sending logs to IBM Log Analysis with LogDNA


  • To confirm the successful creation of LogDNA agent on every worker node in the cluster, run the below command:
kubectl get pods


kubectl commands on IBM Kui tool

Launch the LogDNA Dashboard and View Logs

Let’s check and search the logs and also create some graphs by clicking View LogDNA. On a new tab,under Everything, you should start seeing all the logs in real-time.


For this, we need to generate some traffic/load and there are many open source libraries/tools available. In the post, we will be using Vegeta, an HTTP load testing tool and library. You can also use hey.

Before generating the load, let’s quickly check whether the IP_ADDRESS and HOST_URL are set properly while deploying the app.

echo $IP_ADDRESS


echo $HOST_URL


After installing Vegeta, run the below command

echo “GET http://${IP_ADDRESS}" | vegeta attack -duration=300s -header “Host: ${HOST_URL}” | tee results.bin | vegeta report
 vegeta report -type=json results.bin > metrics.json
 cat results.bin | vegeta plot > plot.html
 cat results.bin | vegeta report -type=”hist[0,100ms,200ms,300ms]”


You can open the plot.html file in the folder you have run the above command to see the Vegeta plot.

On the LogDNA dashboard, you can search/filter for various fields in the search box and also highlight the terms you are interested in. You can also save this as a View as a bookmark by clicking on Unsaved View.


LogDNA dashboard
For archiving logs to IBM Cloud Object Storage, refer to  this link.

You can filter the logs by tags, sources, Apps and Levels (info, error, etc.,).

Filtering the logs

Boards and Graphs

A board is a named collection of graphs and is similar to a view. All boards are located in the Boards List and may contain any number of graphs. Changes made to a board are automatically saved.

To create a new board, on the left pane, click on the icon below the dashboard and click +NEW BOARD. Let’s call this knative-board.

  • Click on +Add Graph.
  • Select "destinationApp" as the field to graph.
  • Choose knative-node-app-00001 as the optional value and click add graph.
New graph creation


A new graph will be created with a plot of destinationApp over a period of 24 hours (Feel free to change the timeframe). You can also add a new plot by clicking +Add Plot below the graph.

knative-board with multiple graphs


As Knative is known for its autoscaling capabilities, Let’s see how the autoscaler behaves with incoming traffic/requests by adding a new graph as shown in the image above.

Knative Serving Autoscaler — another K8s Deployment running a single Pod which watches request load on the Pods running user code. It increases and decreases the size of the Deployment running the user code in order to compensate for higher or lower traffic load.

Additionally, as an extension to the graphs you created, you can see the breakdown (a histogram) of various fields like nodes, destinationNames etc., by clicking on the arrow below the graph > +Add. You can create multiple breakdowns.


Worker Nodes information


We have just touched the tip of the iceberg and there are many fields/metrics to look out for. Explore the tool with different load and filters.

Questions or concerns? Post a question or Reach out on Twitter @VidyasagarMSC

Further Reading

  • Working with alerts
  • Exporting logs to a local file
  • Using Kaniko — Build a container image inside a K8s cluster and push it to IBM Cloud Container Registry
  • IBM, Google Give Birth to Knative Serverless Cloud Project
  • Knative Docs


IBM Cloud Log analysis Kubernetes Cloud cluster app Graph (Unix)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Beginner's Guide to Back-End Development
  • AIOps Being Powered by Robotic Data Automation
  • Image Classification With DCNNs
  • Simulate Network Latency and Packet Drop In Linux

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: