Integrating Humio with Ballerina

The opportunity to build applications and augment them comes with a large set of choices. Choices in log management, choices in API integrators and consumers, choices in languages to use to build the services, and integrations your application needs.

When it comes to log management, Humio has the flexibility and robust ecosystem to handle the needs of application creators and developers. The people behind the cloud native programming language Ballerina feel the same: they want to provide flexibility and the ability to integrate with your application.

In their own words, Ballerina’s syntax, code, and compiler create runtime services and deployment artifacts that are cloud native ready for deployment within your IaaS, orchestrator, or service mesh of choice. The idea here is to integrate with as many services as possible, which brings us to the thrust of this post, integrating a Ballerina application with Humio.

Getting started with Ballerina is pretty straight forward. The team behind Ballerina has developed a great Quick Start guide that takes a new developer from installation to deployment. We suggest using this to familiarise yourself with Ballerina if you’ve never used it.

Assuming there’s a service running on your application and Ballerina is configured as expected, integrating Humio is pretty simple. There are various techniques for sending data to Humio. For this example, we’ll use the platform integration method, using a Ballerina application deployed with Kubernetes.

We’ll start with Helm, the Kubernetes package manager. Directions for installing Helm for your particular OS flavor can be found on the Helm Github page. Next, create a file named humio-agent.yaml (for directions, check out the Humio documentation), replacing $HOST with the hostname of your Humio installation (i.e. cloud.humio.com).

Take your ingest token from your Humio Repository page and replace $INGEST_TOKEN with the ingest token. Finally, we run a simple Helm command to get the logs rolling:

helm install stable/fluent-bit — name=humio-agent -f humio-agent.yaml

Once this is in place and Helm is initialized, your logs should be up and running with the logs from your Ballerina service pushing to Humio. So long as the container with Ballerina running (and its logs) remain active, the log information on Humio should remain populated.

With more and more application developers moving to microservices, combining tools like Ballerina and Humio can create a more flexible environment where it’s easy to discern what is happening under the hood.