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
[SERVICE]
Flush 1
Log_Level info
Daemon off
Parsers_File parsers.conf
[INPUT]
Name tail
Path [The path to the log file where the log will be loaded]
[OUTPUT]
Name stdout
Match *
[FILTER]
Name parser
Match *
Key_Name log
Parser nginx
# Setting to preserve existing log messages before parsing (true: preservation)
Preserve_Key true
Reserve_Data true
# instrumentation_scope, service.name.. in body
[FILTER]
Name modify
Match *
Add service.name 'Application Name'
# Handled by user by inserting script
[FILTER]
Name lua
Match *
script rewrite.lua
call rewrite_tag
[OUTPUT]
Name opentelemetry
Match *
# Host log-agent-cocktail-log-agent.cocktail-addon
Host 'log-agent Service Address'
Port 4318
metrics_uri /v1/metrics
logs_uri /v1/logs
traces_uri /v1/traces
header app_token 'Token'
header app_name 'Application Name'
Log_response_payload True
tls off
tls.verify off
logs_body_key_attributes true[PARSER]
Name nginx
Format regex
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S # A script that adds the value INFO to the value level if the code value is 200, and the value ERROR if it is not 200.
function rewrite_tag(tag, timestamp, record)
if record["code"] == "200" then
record["level"] = "INFO"
else
record["level"] = "ERROR"
end
return 1, timestamp, record
end







