Skip to main content
Fluent Bit is a lightweight log processor and forwarder used in the SambaStack monitoring reference architecture. It collects container logs from Kubernetes nodes, enriches them with metadata, and ships them to OpenSearch for indexing and search.
Reference Architecture Note: This setup uses third-party components. Versions, defaults, and command syntax may change over time. Address any issues not specific to SambaStack to the vendor or project that owns that component.

Prerequisites

Before deploying Fluent Bit, ensure you have:
  • Kubernetes cluster – A running cluster with SambaStack installed
  • OpenSearch – Deployed in the monitoring namespace. See Log Storage - OpenSearch
  • OpenSearch admin password – The password configured during OpenSearch deployment
  • Helm (latest version) – For deploying the Fluent Bit chart
  • kubectl – Configured with access to your target Kubernetes cluster
Fluent Bit requires a running OpenSearch instance. Complete the OpenSearch deployment before proceeding.

Resource requirements

The following are minimum resource recommendations for Fluent Bit:
ComponentCPU RequestMemory RequestStorage
Fluent Bit (per node)100m128Mi
Fluent Bit runs as a DaemonSet with one pod per node. Total cluster resources scale linearly with node count.

Architecture overview

In the SambaStack monitoring reference architecture:
  • Fluent Bit runs as a DaemonSet, ensuring one log forwarder per Kubernetes node
  • Collects logs from all pods and containers via /var/log/pods/
  • Enriches logs with namespace, pod, and container metadata using a Lua filter
  • Forwards logs to OpenSearch using secure TLS connections on port 9200
This deployment uses a custom Fluent Bit configuration stored in a Kubernetes Secret and a Helm-based installation with custom values.
How Fluent Bit log collection works:
  • Kubernetes automatically writes container logs to /var/log/pods/ on each node
  • Fluent Bit reads these logs directly from the host filesystem via a DaemonSet
  • Multiple parsers are configured to support both CRI and Docker log formats
  • Fluent Bit automatically selects the correct parser at runtime
  • Logs are enriched with Kubernetes metadata and forwarded to OpenSearch

Deployment steps

Step 1: Add the Helm repository

Step 2: Retrieve the OpenSearch password

Get the OpenSearch admin password you created during OpenSearch deployment:
Save this password for use in Step 6.

Step 3: Create the Lua script

Save the following as ~/.sambastack-observability/fluentbit/append_tags.lua:
Using a separate Lua file is less error-prone than embedding the code inline in the configuration file.

Step 4: Create the configuration file

Save the following as ~/.sambastack-observability/fluentbit/fluentbit-conf.conf:
INPUT section: Tails log files from all pods, excluding Fluent Bit’s own logs to prevent recursion.FILTER (Lua): Runs the external append_tags.lua script to extract namespace, pod, and container names from the log file path.FILTER (parser): Attempts to parse log content as JSON or nginx ingress format.OUTPUT: Sends logs to OpenSearch with TLS enabled. The logs-7d index name is configurable.SERVICE: Enables the HTTP server on port 2020 for health checks and metrics.

Step 5: Create the configuration secret

The secret name sn-fluentbit must match the secretName in the Helm values file. If you change this name, update the values file accordingly.

Step 6: Create the Helm values file

Save the following as ~/.sambastack-observability/fluentbit/fluentbit-values.yml:

Step 7: install Fluent Bit

Verification

Check pod status

Verify Fluent Bit pods are running on each node:
Expected output (one pod per node):

Verify logs are reaching OpenSearch

Port-forward to the OpenSearch service:
List indices to confirm log ingestion:
Expected output:
The presence of the logs-7d index with a non-zero docs.count confirms Fluent Bit is successfully pushing logs into OpenSearch. To stop the port-forward process:

Query sample logs

Verify log content with a sample query:
You should see log entries with namespace, pod, and container fields populated.

Success criteria

Deployment is considered successful when:
  • Fluent Bit DaemonSet pods are in Running state on all nodes
  • The logs-7d index appears in OpenSearch with documents
  • Sample log queries return entries with namespace/pod/container metadata

Configuration reference

SectionParameterDescription
INPUTBuffer_Chunk_SizeInitial buffer size for reading log files (10MB)
INPUTBuffer_Max_SizeMaximum buffer size per monitored file (64MB)
INPUTMem_Buf_LimitMemory buffer limit before backpressure (64MB)
INPUTRotate_waitSeconds to wait before reading rotated files (120)
INPUTExclude_PathGlob pattern for logs to skip (Fluent Bit’s own logs)
OUTPUTIndexOpenSearch index name for logs (logs-7d)
OUTPUTtlsEnable TLS for OpenSearch connection
OUTPUTtls.verifyVerify TLS certificate (Off for self-signed)
SERVICEFlushInterval in seconds to flush records to output (10)
SERVICEHTTP_PortPort for Fluent Bit’s HTTP server metrics (2020)

Troubleshooting

Pods not starting (ImagePullBackOff)

Symptom: Fluent Bit pods show ImagePullBackOff or ErrImagePull. Solution: Verify your cluster can reach the container registry. Check for network policies or proxy requirements.

No logs appearing in OpenSearch

Symptom: The logs-7d index doesn’t exist or has zero documents. Possible causes and solutions:
  1. OpenSearch not reachable:
  2. Wrong password: Verify the password in fluentbit-values.yml matches the OpenSearch admin password.
  3. Secret not mounted:

Logs missing metadata fields

Symptom: Logs appear in OpenSearch but namespace, pod, or container fields are missing. Cause: The Lua filter failed to parse the log file path. Solution: Check that logs are coming from the expected path pattern (/var/log/pods/*/*/*.log).

High memory usage

Symptom: Fluent Bit pods are OOMKilled or show high memory consumption. Solution: Reduce buffer sizes in the configuration:

Next steps

After Fluent Bit is forwarding logs:
  1. Deploy Prometheus and Grafana – Add visualization dashboards for your logs. See Monitoring with Prometheus and Grafana.
  2. Explore logs in Grafana – Once Grafana is deployed with the OpenSearch datasource, you can query and visualize logs using the Explore feature.

Cleanup

To remove Fluent Bit from your cluster: Uninstall the Helm release:
Delete the configuration secret:
Removing Fluent Bit stops log forwarding but does not delete existing logs in OpenSearch. To remove historical logs, delete the index directly in OpenSearch or wait for index lifecycle policies to expire the data.