You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 29a4a64
Browse filesBrowse the repository at this point in the historyBrowse files
[monitoring] Auto-route logs per-tenant using namespace labels
Replace manual tenantLogRouting list with automatic discovery using
Helm lookup on namespace.cozystack.io/monitoring labels, matching
the existing vmagent pattern for metrics routing.
- Use lookup "v1" "Namespace" to discover tenant namespaces
- Generate rewrite_tag filters and HTTP outputs dynamically
- Deduplicate targets (multiple namespaces -> one output per target)
- Fix default outputs to use vlinsert-generic:9481 (VLCluster)
- Remove manual tenantLogRouting configuration
Signed-off-by: Mattia Eleuteri <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
uri /insert/jsonline?_stream_fields=log_source,stream,kubernetes_pod_name,kubernetes_container_name,kubernetes_namespace_name&_msg_field=log&_time_field=date
{{- $monTarget := index (default dict $ns.metadata.labels) "namespace.cozystack.io/monitoring" }}
383
+
{{- if and $monTarget (ne $monTarget "") (ne $monTarget $defaultTarget) }}
384
+
{{- $_ := set $uniqueTargets $monTarget true }}
385
+
{{- end }}
386
+
{{- end }}
387
+
{{- end }}
388
+
{{- range $target, $_ := $uniqueTargets }}
389
+
[OUTPUT]
390
+
Name http
391
+
Match tenant.{{ $target }}.*
392
+
Host vlinsert-generic.{{ $target }}.svc
393
+
port 9481
394
+
compress gzip
395
+
uri /insert/jsonline?_stream_fields=log_source,stream,kubernetes_pod_name,kubernetes_container_name,kubernetes_namespace_name&_msg_field=log&_time_field=date
0 commit comments