Skip to content

Commit 70274a7

Browse files
Mattia Eleuterimattia-eleuteri
authored andcommitted
[monitoring] Add per-tenant log routing support in fluent-bit
- Add per-tenant log routing configuration for fluent-bit - Escape namespace with regexQuoteMeta in rewrite_tag rules - Add validation that namespace is not empty Signed-off-by: Mattia Eleuteri <[email protected]> Signed-off-by: mattia-eleuteri <[email protected]>
1 parent a13481b commit 70274a7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

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

Lines changed: 25 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,20 @@ 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+
[OUTPUT]
385+
Name http
386+
Match tenant.{{ .namespace }}.*
387+
Host {{ .vlogs }}
388+
port 9428
389+
compress gzip
390+
uri /insert/jsonline?_stream_fields=log_source,stream,kubernetes_pod_name,kubernetes_container_name,kubernetes_namespace_name&_msg_field=log&_time_field=date
391+
format json_lines
392+
json_date_format iso8601
393+
header AccountID 0
394+
header ProjectID 0
395+
{{- end }}
377396
filters: |
378397
[FILTER]
379398
Name kubernetes
@@ -423,6 +442,12 @@ fluent-bit:
423442
Name modify
424443
Match *
425444
Add cluster root-cluster
445+
{{- range .Values.tenantLogRouting }}
446+
[FILTER]
447+
Name rewrite_tag
448+
Match kube.*
449+
Rule $kubernetes_namespace_name ^({{ .namespace | regexQuoteMeta }})$ tenant.{{ .namespace }}.$TAG false
450+
{{- end }}
426451
scrapeRules:
427452
etcd:
428453
enabled: false

0 commit comments

Comments
 (0)