Fluent Bit is a lightweight log data collector that is used to collect and process data. By installing Flentbit as a sidecar in your application, you parse the application's logs and forward them to O
The above guide explains how the application stores logs in the /var/log directory. Please modify the directory and log pattern to suit your environment.
Application to collect logs - Settings - Container Click the "Add" button to create a container as follows.
Image:
fluent/fluent-bit:3.0.0
When you press the save button, the container runs in the existing application in fluent-bit sidecar format.
Logs are stored in the path set in Log Appender, so you need to create a volume in the container and mount it.
Application to collect logs - Settings - Volume - Click the "Create" button to create a volume as follows.
Volume Type
: Empty Dir
Volume Name
: custom name
The following is the process of mounting the created volume.
Application to collect logs - Settings - Volume mount - Click the "Add" button to mount the volume with the following settings.
Container Path
: File path set in Log Appender (eg. /var/log)
The container must mount the directory path where it stores the logs before it can read the file and parse the logs.
You can also add labels or change the label name through Config provided by fluent-bit.
Service map to collect logs - Configuration information - Click the "Create" button to create a configuration map.
Name
: The name of the config map you want to set.
Description
: Additionally, a description of the config map to be specified by the user.
Click the “Add” button to add the config file.
The following config file is not absolute. The location where the log is loaded or the log pattern may vary, so please set it according to your environment.
log-agent Service Address
: Infrastructure - Cluster - Add-ons - Click 'log-agent' and check the service name.
( http port = 4318 , grpc port = 4317)
parsers.conf
Application logs create a label called 'level' to provide users with the ability to filter by level. The following is an example of converting nginx's code value to level when the user's application does not have a value called level.
rewrite.lua
Once the config map creation is complete, return to the application to create the volume.
Application to collect logs - Settings - Volume - Click the "Create" button to create a volume as follows.
Volume Type
: Config Map
Volume Name
: Custom Name
Config Map
: User-created ConfigMap name
Permission
: 644
The following is the process of mounting the created volume.
Application to collect logs - Settings - Volume mount - Click the "Add" button to mount the volume with the following settings.
Container Path
: Log Data - Directory path where logs are stored (eg. /var/log)
Container Path
: Fluent-bit -conf -fluent-bit configuration file path (eg. /fluent-bit/etc)
When the fluent-bit container does not operate properly