Skip to content

Commit 29fb7ab

Browse files
committed
chore(fluentbit): check config
1 parent bee729f commit 29fb7ab

3 files changed

Lines changed: 91 additions & 76 deletions

File tree

addons/fluentbit/2/chart/fluentbit/templates/configmap.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ data:
1616
parsers.conf: |
1717
{{- (tpl .Values.daemonset.config.parsers $) | nindent 4 }}
1818
fluentbit.conf: |
19-
{{- (tpl .Values.daemonset.config.service $) | nindent 4 }}
20-
{{- (tpl .Values.daemonset.config.inputs $) | nindent 4 }}
21-
{{- (tpl .Values.daemonset.config.outputs $) | nindent 4 }}
19+
{{- $service := (tpl .Values.daemonset.config.service $) }}
20+
{{- if not (contains "[INPUT]" $service) }}
21+
{{- $service | nindent 4 }}
22+
{{- end }}
23+
24+
{{- (tpl .Values.daemonset.config.inputs $) | nindent 4 }}
25+
26+
{{- $filters := (tpl .Values.daemonset.config.filters $) }}
27+
{{- if not (contains "[INPUT]" $filters) }}
28+
{{- $filters | nindent 4 }}
29+
{{- end }}
30+
31+
{{- $outputs := (tpl .Values.daemonset.config.outputs $) }}
32+
{{- if not (contains "[INPUT]" $outputs) }}
33+
{{- (tpl .Values.daemonset.config.outputs $) | nindent 4 }}
34+
{{- end }}

addons/fluentbit/2/chart/fluentbit/values.yaml

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -165,107 +165,109 @@ daemonset:
165165
flush: 1
166166
## https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/configuration-file
167167
config:
168-
multilines : python_multiline,java_multiline,go_multiline,gateway_multiline
169168
service: |
170169
[SERVICE]
171-
Flush {{ .Values.daemonset.flush }}
172-
Daemon Off
173-
Log_Level info
174-
HTTP_Server On
175-
HTTP_Listen 127.0.0.1
176-
HTTP_PORT 2020
177-
Hot_Reload On
178-
Parsers_File /opt/drycc/fluent-bit/etc/fluent-bit/parsers.conf
170+
Flush {{ .Values.daemonset.flush }}
171+
Daemon Off
172+
Log_Level info
173+
HTTP_Server On
174+
HTTP_Listen 127.0.0.1
175+
HTTP_PORT 2020
176+
Hot_Reload On
177+
Parsers_File /opt/drycc/fluent-bit/etc/fluent-bit/parsers.conf
179178
180179
## https://docs.fluentbit.io/manual/pipeline/inputs
181180
inputs: |
182181
[INPUT]
183-
Name tail
184-
Path /var/log/containers/*_{{ .Release.Namespace }}_*.log
185-
DB /data/containers.pos.db
186-
DB.locking true
187-
Offset_Key offset
188-
Tag kubernetes.<namespace_name>.<pod_name>.<container_name>.<container_id>
189-
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<container_id>[a-z0-9]{64})\.log$
190-
Read_from_Head false
191-
multiline.parser docker,cri
182+
Name tail
183+
Path /var/log/containers/*_{{ .Release.Namespace }}_*.log
184+
DB /data/containers.pos.db
185+
DB.locking true
186+
Offset_Key offset
187+
Tag kubernetes.<namespace_name>.<pod_name>.<container_name>.<container_id>
188+
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<container_id>[a-z0-9]{64})\.log$
189+
Read_from_Head false
190+
multiline.parser docker,cri
192191
192+
## https://docs.fluentbit.io/manual/pipeline/filters
193+
filters: |
193194
[FILTER]
194-
Name Lua
195-
Match kubernetes.*
196-
call append_tag
197-
code function append_tag(tag, timestamp, record) new_record = record local namespace, pod_name, container_name, container_id = string.match(tag, "kubernetes%.([^%.]+)%.([^%.]+)%.([^%.]+)%.(.+)") if namespace and pod_name and container_name and container_id then new_record["pod_name"] = pod_name new_record["namespace"] = namespace new_record["container_name"] = container_name new_record["container_id"] = container_id end return 1, timestamp, new_record end
195+
Name Lua
196+
Match kubernetes.*
197+
call append_tag
198+
code function append_tag(tag, timestamp, record) new_record = record local namespace, pod_name, container_name, container_id = string.match(tag, "kubernetes%.([^%.]+)%.([^%.]+)%.([^%.]+)%.(.+)") if namespace and pod_name and container_name and container_id then new_record["pod_name"] = pod_name new_record["namespace"] = namespace new_record["container_name"] = container_name new_record["container_id"] = container_id end return 1, timestamp, new_record end
198199
199200
[FILTER]
200-
name multiline
201-
match kubernetes.*
202-
multiline.parser {{ .Values.daemonset.config.multilines }}
203-
multiline.key_content log
204-
buffer on
201+
name multiline
202+
match kubernetes.*
203+
multiline.parser python_multiline,java_multiline,go_multiline,gateway_multiline
204+
multiline.key_content log
205+
buffer on
205206
206207
## https://docs.fluentbit.io/manual/pipeline/outputs
207208
outputs: |
208209
[OUTPUT]
209-
Name stdout
210-
Match kubernetes.*
210+
Name stdout
211+
Match kubernetes.*
212+
211213
## https://docs.fluentbit.io/manual/pipeline/parsers
212214
parsers: |
213215
[PARSER]
214-
Name docker
215-
Format json
216-
Time_Key time
217-
Time_Format %Y-%m-%dT%H:%M:%S.%L
218-
Time_Keep On
216+
Name docker
217+
Format json
218+
Time_Key time
219+
Time_Format %Y-%m-%dT%H:%M:%S.%L
220+
Time_Keep On
219221
220222
[PARSER]
221223
# http://rubular.com/r/tjUt3Awgg4
222-
Name cri
223-
Format regex
224-
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$
225-
Time_Key time
226-
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
227-
Time_Keep On
224+
Name cri
225+
Format regex
226+
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$
227+
Time_Key time
228+
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
229+
Time_Keep On
228230
229231
[MULTILINE_PARSER]
230-
Name python_multiline
231-
Type regex
232-
Flush_Timeout 1000
233-
key_content log
234-
Rule "start_state" "/^\[.*ERROR.*-- Internal Server Error: .*$/" "cont"
235-
Rule "cont" "/^Traceback \(most recent call last\):$/" "cont"
236-
Rule "cont" "/^\s+File \"/" "cont"
237-
Rule "cont" "/^\s+raise /" "cont"
238-
Rule "cont" "/^\s?\w+Error: /" "cont"
239-
Rule "cont" "/^\s+/" "cont"
232+
Name python_multiline
233+
Type regex
234+
Flush_Timeout 1000
235+
key_content log
236+
Rule "start_state" "/^\[.*ERROR.*-- Internal Server Error: .*$/" "cont"
237+
Rule "cont" "/^Traceback \(most recent call last\):$/" "cont"
238+
Rule "cont" "/^\s+File \"/" "cont"
239+
Rule "cont" "/^\s+raise /" "cont"
240+
Rule "cont" "/^\s?\w+Error: /" "cont"
241+
Rule "cont" "/^\s+/" "cont"
240242
241243
[MULTILINE_PARSER]
242-
Name java_multiline
243-
Type regex
244-
Flush_Timeout 1000
245-
key_content log
246-
Rule "start_state" "/^\d{4}-\d{2}-\d{2}/" "cont"
247-
Rule "cont" "/^\s+at /" "cont"
248-
Rule "cont" "/^[a-z]/" "cont"
249-
Rule "cont" "/^Caused by:/" "cont"
250-
Rule "cont" "/^\s+/" "cont"
251-
Rule "cont" "/^(?!\d{4}-\d{2}-\d{2})/" "cont"
244+
Name java_multiline
245+
Type regex
246+
Flush_Timeout 1000
247+
key_content log
248+
Rule "start_state" "/^\d{4}-\d{2}-\d{2}/" "cont"
249+
Rule "cont" "/^\s+at /" "cont"
250+
Rule "cont" "/^[a-z]/" "cont"
251+
Rule "cont" "/^Caused by:/" "cont"
252+
Rule "cont" "/^\s+/" "cont"
253+
Rule "cont" "/^(?!\d{4}-\d{2}-\d{2})/" "cont"
252254
253255
[MULTILINE_PARSER]
254-
Name go_multiline
255-
Type regex
256-
Flush_Timeout 1000
257-
key_content log
258-
Rule "start_state" "/^panic: /" "cont"
259-
Rule "cont" "/^\s+/" "cont"
260-
Rule "cont" "/^goroutine /" "cont"
256+
Name go_multiline
257+
Type regex
258+
Flush_Timeout 1000
259+
key_content log
260+
Rule "start_state" "/^panic: /" "cont"
261+
Rule "cont" "/^\s+/" "cont"
262+
Rule "cont" "/^goroutine /" "cont"
261263
262264
[MULTILINE_PARSER]
263265
Name gateway_multiline
264266
Type regex
265267
Flush_Timeout 1000
266268
key_content log
267-
Rule "start_state" "/^\[\d{4}-\d{2}-\d{2}/" "cont"
268-
Rule "cont" "/^(?!\[\d{4}-\d{2}-\d{2})/" "cont"
269+
Rule "start_state" "/^\[\d{4}-\d{2}-\d{2}/" "cont"
270+
Rule "cont" "/^(?!\[\d{4}-\d{2}-\d{2})/" "cont"
269271
270272
## @param daemonset.extraEnvVars Array with extra environment variables to add to daemonset nodes
271273
## e.g:

addons/fluentbit/2/meta.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ allow_parameters:
2020
description: "extra environment variables to add to fluentbit"
2121
- name: "daemonset.config.outputs"
2222
required: true
23-
description: "destinations for your data: databases, cloud services and more"
24-
- name: "daemonset.config.multilines"
23+
description: "fluentbit outputs config"
24+
- name: "daemonset.config.filters"
2525
equired: false
26-
description: "destinations multilines"
26+
description: "fluentbit filters config"
2727
- name: "daemonset.config.parsers"
2828
equired: false
29-
description: "destinations parsers"
29+
description: "fluentbit parsers config"
3030
archive: false

0 commit comments

Comments
 (0)