Skip to content

Commit 6ffc7fe

Browse files
committed
chore(fluentbit): add custom input path
1 parent 559d406 commit 6ffc7fe

5 files changed

Lines changed: 28 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ Chart.lock
5252
*.fix
5353
addons/grafana/10/dashborad/
5454
addons/prometheus/prom-value.yaml
55+
toCopy/

addons/fluentbit/2/chart/fluentbit/templates/_helpers.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,22 @@ Return the Fluentbit Reloader image name
6060
{{- include "fluentbit.image" . -}}
6161
{{- end -}}
6262
{{- end -}}
63+
64+
{{/*
65+
Return the Fluentbit input path
66+
*/}}
67+
{{- define "input.paths" -}}
68+
{{- $namespace := .Release.Namespace -}}
69+
{{- $wildcards := .Values.daemonset.config.podWildcards -}}
70+
{{- $pathTemplate := "/var/log/containers/%s_%s_*.log" -}}
71+
72+
{{/* */}}
73+
{{- $paths := list -}}
74+
{{- range $wildcard := $wildcards -}}
75+
{{- $path := printf $pathTemplate $wildcard $namespace -}}
76+
{{- $paths = append $paths $path -}}
77+
{{- end -}}
78+
{{- join "," $paths -}}
79+
{{- end -}}
80+
81+

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ daemonset:
164164
type: OnDelete
165165
flush: 1
166166
## https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/configuration-file
167-
config:
168-
167+
config:
168+
podWildcards:
169+
- "*"
169170
service: |
170171
[SERVICE]
171172
Flush {{ .Values.daemonset.flush }}
@@ -181,7 +182,7 @@ daemonset:
181182
inputs: |
182183
[INPUT]
183184
Name tail
184-
Path /var/log/containers/*_{{ .Release.Namespace }}_*.log
185+
Path {{ include "input.paths" . }}
185186
DB /data/containers.pos.db
186187
DB.locking true
187188
Offset_Key offset

addons/fluentbit/2/meta.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ allow_parameters:
1818
- name: "daemonset.extraEnvVars"
1919
required: false
2020
description: "extra environment variables to add to fluentbit"
21+
- name: "daemonset.config.podWildcards"
22+
equired: false
23+
description: "fluentbit inout paths pod wildcards"
2124
- name: "daemonset.config.outputs"
2225
required: true
2326
description: "destinations for your data: databases, cloud services and more"

addons/grafana/10/chart/grafana/templates/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ data:
3232
GF_PATHS_CONFIG: "/opt/drycc/grafana/conf/grafana.ini"
3333
GF_PATHS_DATA: "/opt/drycc/grafana/data"
3434
GF_PATHS_LOGS: "/opt/drycc/grafana/logs"
35+

0 commit comments

Comments
 (0)