Skip to main content
Welcome to this lesson. In the previous lesson, we successfully installed our Event Generator App. In this session, we configure Fluent Bit to monitor application logs. All configuration files are located in the current working directory, and each file plays a crucial role in deploying Fluent Bit on your Kubernetes cluster.

Listing the Fluent Bit Files

First, let’s list the files related to Fluent Bit:
Each file is responsible for different configuration aspects of Fluent Bit—from deploying a DaemonSet to specifying the ServiceAccount, ConfigMap, and RBAC permissions.

DaemonSet for Fluent Bit

The fluent-bit.yaml file creates a DaemonSet in the efk namespace. This DaemonSet deploys Fluent Bit on every node, ensuring that logs are collected consistently. Below is an excerpt from the file:
This configuration mounts the ConfigMap named “fluent-bit” as a volume to drive the Fluent Bit configuration within each pod.

ConfigMap: Fluent Bit Configuration and Parsers

The ConfigMap (fluent-bit-configmap.yaml) defines how Fluent Bit processes logs, sets service parameters, and configures inputs, filters, and outputs. A custom parser docker_no_time is defined to correctly handle Docker JSON logs. Here is the consolidated configuration:
Key points in this configuration:
  • The [SERVICE] section sets global properties such as flush intervals, log level, and HTTP server settings used for health checks.
  • The [INPUT] sections define sources: one tailing container logs and one collecting systemd logs (filtered for kubelet.service).
  • The [FILTER] section enriches logs with Kubernetes metadata and handles merging and parsing.
  • The [OUTPUT] sections forward logs to Elasticsearch with proper formatting and connection parameters.

ServiceAccount for Fluent Bit

The ServiceAccount defined in fluent-bit-sa.yaml ensures that Fluent Bit can authenticate with the Kubernetes API for log metadata collection:

ClusterRole for Fluent Bit

To grant Fluent Bit the necessary permissions to access Kubernetes resources, a ClusterRole is defined in fluent-bit-clusterrole.yaml. This role grants comprehensive access to the required resources:
The corresponding ClusterRoleBinding (in fluent-bit-clusterrolebinding.yaml) binds this role to the Fluent Bit ServiceAccount.

Deploying Fluent Bit

With all configuration files in place, deploy Fluent Bit with the following command:
The expected output should be similar to:
Since the Event Generator App is already deployed, only the Fluent Bit configuration is updated without redeploying the app.

Verifying Fluent Bit Logging

To ensure Fluent Bit is running and correctly processing logs, follow these steps:
  1. Check the pods:
  2. View the logs of a Fluent Bit pod:
Example output:
This output indicates that Fluent Bit is properly collecting logs and will soon forward them to Elasticsearch.

Next Steps

In the next lesson, we will explore how to visualize the log data in Kibana, confirming that logs are successfully reaching Elasticsearch via Fluent Bit. Happy logging!

Watch Video