Fluent Bit
설치
helm repo add fluent https://fluent.github.io/helm-charts
helm repo update fluent \
&& helm search repo fluent/fluent-bit -l | head -n 10
helm show values fluent/fluent-bit \
--version 0.39.0 \
> fluent-bit-values.yaml
fluent-bit-values.yaml
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
memory: 128Mi
tolerations:
- operator: Exists
labels: {}
luaScripts:
# https://docs.fluentbit.io/manual/pipeline/filters/lua
tag.lua: |
function add_tag(tag, timestamp, record)
new_record = record
new_record["tag"] = tag
return 2, timestamp, new_record
end
config:
# https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/configuration-file#config_section
service: |
[SERVICE]
Daemon Off
Flush {{ .Values.flush }}
Log_Level {{ .Values.logLevel }}
Parsers_File /fluent-bit/etc/parsers.conf
Parsers_File /fluent-bit/etc/conf/custom_parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port {{ .Values.metricsPort }}
Health_Check On
# https://docs.fluentbit.io/manual/administration/buffering-and-storage
storage.path /var/log/flb-storage/
storage.metrics On
filters: |
[FILTER]
# log키에 있는 json 텍스트를 파싱하여 키/값으로 분리 후 log 키 삭제
Name parser
Match *
Parser docker
Key_Name log
[FILTER]
# docker parser가 실패한 경우 level=warn 추가
Name modify
Match *
Condition Key_Exists log
Add level warn
[FILTER]
# fluent-bit tag를 tag키의 값으로 추가
Name lua
Match *
script /fluent-bit/scripts/tag.lua
call add_tag
helm template fluent-bit fluent/fluent-bit \
--version 0.39.0 \
-n monitoring \
-f fluent-bit-values.yaml \
> fluent-bit.yaml
helm upgrade -i fluent-bit fluent/fluent-bit \
--history-max 5 \
--version 0.39.0 \
-n monitoring \
-f fluent-bit-values.yaml