Kubernetes

Kubernetes

This guide describes how to send logs from your Kubernetes cluster to your Humio cluster. When it comes to managing micro-services in a Kubernetes cluster, Humio is a great way to get insights into your applications. While other log shippers are supported, we focus on using Fluent Bit for forwarding log messages to Humio.

Helm

Take advantage of Humio with your Kubernetes setup.

We’ll start with Helm, the Kubernetes package manager. Directions for installing Helm for your particular OS are on the Helm GitHub page.

Once you’ve installed Helm, update the main Helm chart repository. This main repository contains sub-charts for Humio.

shell
helm repo add humio https://humio.github.io/humio-helm-charts
helm repo update

Next, create a file named humio-agent.yaml with the following content:

humio
humio-fluentbit:
  enabled: true
  humioHostname: $YOUR_HUMIO_URL
  es:
    tls: true

Replace $YOUR_HUMIO_URL with the hostname of your Humio installation (this defaults to cloud.humio.com). Take your ingest token from your Humio Repository page.

Figure 1, Humio Repository

– and replace $INGEST_TOKEN with the ingest token when running the install command below. We recommend running in a separate namespace, in our example the logging namespace.

shell
# Helm v3+
helm install humio humio/humio-helm-charts \
  --namespace logging \
  --set humio-fluentbit.token=$INGEST_TOKEN \
  --values humio-agent.yml

# Helm v2
helm install humio/humio-helm-charts --name humio \
  --namespace logging \
  --set humio-fluentbit.token=$INGEST_TOKEN \
  --values humio-agent.yaml

Once this is in place, the Kubernetes logs should be flowing into the Humio cluster.

Parsing Logs

Humio will look for the pod label humio-parser and use that parser on the log line. That way you can control how Humio parses the data by configuring your pods. If the humio-parser label is not set, no parser will be applied to the log lines.

Additional Filters

In some cases you might want to make some changes to the Fluent Bit configuration. The easiest way to do that is by updating the values.yaml with the filter and updating the Helm chart.

First, update the values.yaml by adding a customFluentBitConfig section containing custom Fluent Bit configurations:

ini
humio-fluentbit:
  enabled: true
  humioHostname: $YOUR_HUMIO_URL
  es:
    tls: true
  customFluentBitConfig:
    custom-filter-kubernetes.conf: |-
      [FILTER]
       Name     modify
       Match    *
       Rename   log rawstring

Then upgrade the helm chart

shell
helm upgrade humio humio/humio-helm-charts \
  --values humio-agent.yaml

Uninstalling

shell
helm delete --purge humio

And optionally clean up the namespace

shell
kubectl delete namespace logging --cascade=true

For more information see Advanced log routing with Fluent Bit 1.4.