Your Kubernetes platform already collects its logs with Fluent Bit, and the team does not want to switch agents to adopt Dynatrace. Good news: a Fluent Bit Dynatrace setup works without a dedicated plugin, using the standard HTTP output and the log ingest API.

The logs still need to arrive enriched. A line without namespace, pod or cluster is almost useless on call: you cannot link it to the Kubernetes entity or to the trace that produced it, and MTTR grows accordingly.

The goal of this tutorial: deploy Fluent Bit as a DaemonSet with Helm, rename Kubernetes metadata into the fields Dynatrace expects, send logs to API v2 and confirm they arrive with DQL. It applies to Dynatrace SaaS and Dynatrace Managed; only the ingest URL changes.

Fluent Bit Dynatrace or OneAgent: which one to choose

If the Dynatrace Operator already runs with log collection, there is no reason to add Fluent Bit. Fluent Bit makes sense when it is already the team’s standard, when part of the logs also goes to another tool, or on clusters where OneAgent is not deployed. For the bigger picture, see the module on logs and OpenPipeline.

Prerequisites

  • A Kubernetes cluster with a containerd or CRI-O runtime (CRI log format), kubectl and Helm 3.
  • A Dynatrace API token with the logs.ingest scope (Ingest logs), and nothing more.
  • The ingest URL: https://<env-id>.live.dynatrace.com/api/v2/logs/ingest on SaaS, https://<domain>/e/<env-id>/api/v2/logs/ingest on Managed (or through an ActiveGate).
  • Read access to logs in Dynatrace for the check.

Step 1: store the token in a secret

Never put the token in clear text in a versioned values file. Create a namespace and a secret:

kubectl create namespace logging kubectl -n logging create secret generic dynatrace-logs \ --from-literal=DT_INGEST_TOKEN="$DT_INGEST_TOKEN" \ --from-literal=DT_INGEST_HOST="abc12345.live.dynatrace.com" 

On Managed, DT_INGEST_HOST takes your domain, and the /e/<env-id> path goes into the output URI (step 3). For the usual 401 and 403 errors, keep API token troubleshooting at hand.

Step 2: read container logs and add Kubernetes context

Create a values-dynatrace.yaml file for the official fluent/fluent-bit chart. The input reads container log files; the kubernetes filter adds namespace, pod and container; the modify filter renames those fields to the k8s.* convention.

envFrom: - secretRef: name: dynatrace-logs env: - name: K8S_CLUSTER_NAME value: "prod-eu-1" podAnnotations: dynatrace.com/inject: "false" config: inputs: | [INPUT] Name tail Tag kube.* Path /var/log/containers/*.log multiline.parser cri DB /var/log/flb_kube.db Mem_Buf_Limit 20MB Skip_Long_Lines On filters: | [FILTER] Name kubernetes Match kube.* Merge_Log On Keep_Log Off Labels Off Annotations Off [FILTER] Name nest Match kube.* Operation lift Nested_under kubernetes Add_prefix k_ [FILTER] Name modify Match kube.* Rename log content Rename k_namespace_name k8s.namespace.name Rename k_pod_name k8s.pod.name Rename k_pod_id k8s.pod.uid Rename k_container_name k8s.container.name Rename k_host k8s.node.name Add k8s.cluster.name ${K8S_CLUSTER_NAME} Remove_wildcard k_ 

Critical lines: multiline.parser cri stitches back lines split by the runtime; Rename log content puts the message in the field Dynatrace shows as content; the dynatrace.com/inject: "false" annotation stops the Operator from instrumenting Fluent Bit itself. If your applications log JSON, Merge_Log On lifts its keys to the top level: make sure none of them is already called content.

Step 3: configure the HTTP output to Dynatrace

Add the output to the same file:

 outputs: | [OUTPUT] Name http Match kube.* Host ${DT_INGEST_HOST} Port 443 URI /api/v2/logs/ingest Format json json_date_key timestamp json_date_format iso8601 Header Authorization Api-Token ${DT_INGEST_TOKEN} Header Content-Type application/json; charset=utf-8 allow_duplicated_headers false tls On tls.verify On Retry_Limit 5 

Format json sends an array of records, which is what the API expects; json_date_key timestamp gives each log its original timestamp. On Managed, replace the URI with /e/<env-id>/api/v2/logs/ingest. Retry_Limit caps retries when the endpoint is unavailable: beyond it, batches are dropped, which must show up in the metrics (see the check below).

Step 4: deploy with Helm

helm repo add fluent https://fluent.github.io/helm-charts helm repo update helm upgrade --install fluent-bit fluent/fluent-bit \ -n logging -f values-dynatrace.yaml kubectl -n logging rollout status daemonset/fluent-bit 

One pod per node should reach the Running state.

How to check it works

  1. In the Fluent Bit logs, no [error] line related to the HTTP output: kubectl -n logging logs ds/fluent-bit | grep -iE "error|http_status". A 204 or 200 status means the batch was accepted; a 401 or 403 points to the token.
  2. In Dynatrace (SaaS on Grail), run:

    fetch logs, from: -15m | filter k8s.cluster.name == "prod-eu-1" | summarize lines = count(), by: { k8s.namespace.name } | sort lines desc 

    Every active namespace should appear. On Managed, use the log viewer and filter on the same attribute.

  3. Expose Fluent Bit’s internal metrics (port 2020, path /api/v1/metrics/prometheus) and watch the output’s retry and drop counters: a non-zero drop count means lost logs.

Good practices

  • Filter early: a grep filter on noisy namespaces costs less than processing after ingest.
  • Give the log pipeline itself an SLO (share of accepted batches) and alert on silence, as in detecting silence and excess volume.
  • Add trace_id and span_id to application logs to correlate with traces (see linking logs and traces).
  • Enable on-disk buffering (storage.type filesystem) if a network outage of several minutes is plausible.
  • Rotate the token and restrict it to the logs.ingest scope only.

Frequently asked questions

Do I need an ActiveGate between Fluent Bit and Dynatrace?

Not on SaaS: Fluent Bit can send directly to the environment. An environment ActiveGate is still useful when the cluster has no outbound Internet access, or on Managed to concentrate traffic; the URI then follows the ActiveGate format.

Why do my logs arrive with the wrong timestamp?

Check json_date_key and json_date_format: without them, Dynatrace uses the time of receipt. A drift of several minutes breaks correlation during an incident.

Can I keep Fluent Bit and OneAgent on the same cluster?

Yes, but do not collect the same files on both sides: you would pay for the same logs twice. Split by namespace or disable log collection on one of them.

Conclusion

With an HTTP output, a secret, a rename to k8s.* fields and a DQL check, Fluent Bit feeds Dynatrace without switching agents. Add monitoring of the pipeline itself, and your Kubernetes logs become a reliable source for diagnosis.

span.observer is an independent community blog, not affiliated with Dynatrace LLC. Dynatrace is a trademark of its owner. Options and fields change: check them in the Fluent Bit documentation and in the Dynatrace documentation.

Originally published on span.observer. French version: https://span.observer/fr/fluent-bit-dynatrace-logs-kubernetes/.