Skip to content

Commit 28a6826

Browse files
Mattia Eleuterimattia-eleuteri
authored andcommitted
[monitoring] Add per-tenant log routing support in fluent-bit
Signed-off-by: Mattia Eleuteri <[email protected]> Signed-off-by: mattia-eleuteri <[email protected]>
1 parent a13481b commit 28a6826

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎packages/system/monitoring-agents/values.yaml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ vmagent:
285285
extraArgs: {}
286286

287287
fluent-bit:
288+
# Per-tenant log routing: routes logs from tenant namespaces to their own VLogs
289+
# tenantLogRouting:
290+
# - namespace: tenant-example
291+
# vlogs: vlogs-generic.tenant-example.svc
292+
tenantLogRouting: []
288293
rbac:
289294
eventsAccess: true
290295
readinessProbe:
@@ -374,6 +379,21 @@ fluent-bit:
374379
json_date_format iso8601
375380
header AccountID 0
376381
header ProjectID 0
382+
{{- range .Values.tenantLogRouting }}
383+
{{- if not .namespace }}{{ fail "tenantLogRouting: namespace is required" }}{{- end }}
384+
{{- if not .vlogs }}{{ fail "tenantLogRouting: vlogs is required" }}{{- end }}
385+
[OUTPUT]
386+
Name http
387+
Match tenant.{{ .namespace }}.*
388+
Host {{ .vlogs }}
389+
port 9428
390+
compress gzip
391+
uri /insert/jsonline?_stream_fields=log_source,stream,kubernetes_pod_name,kubernetes_container_name,kubernetes_namespace_name&_msg_field=log&_time_field=date
392+
format json_lines
393+
json_date_format iso8601
394+
header AccountID 0
395+
header ProjectID 0
396+
{{- end }}
377397
filters: |
378398
[FILTER]
379399
Name kubernetes
@@ -423,6 +443,13 @@ fluent-bit:
423443
Name modify
424444
Match *
425445
Add cluster root-cluster
446+
{{- range .Values.tenantLogRouting }}
447+
{{- if not .namespace }}{{ fail "tenantLogRouting: namespace is required" }}{{- end }}
448+
[FILTER]
449+
Name rewrite_tag
450+
Match kube.*
451+
Rule $kubernetes_namespace_name ^({{ .namespace }})$ tenant.{{ .namespace }}.$TAG false
452+
{{- end }}
426453
scrapeRules:
427454
etcd:
428455
enabled: false

0 commit comments

Comments
 (0)