diff --git a/operations/helm/charts/mimir-distributed/CHANGELOG.md b/operations/helm/charts/mimir-distributed/CHANGELOG.md index ef1531c3cac..b1942903148 100644 --- a/operations/helm/charts/mimir-distributed/CHANGELOG.md +++ b/operations/helm/charts/mimir-distributed/CHANGELOG.md @@ -80,6 +80,7 @@ Entries should include a reference to the Pull Request that introduced the chang * [ENHANCEMENT] Make the PSP template configurable via `rbac.podSecurityPolicy`. #7190 * [ENHANCEMENT] Recording rules: add native histogram recording rules to `cortex_request_duration_seconds`. #7528 * [ENHANCEMENT] Make the port used in ServiceMonitor for kube-state-metrics configurable. #7507 +* [ENHANCEMENT] The new value `metaMonitoring.grafanaAgent.logs.clusterLabel` controls whether to add a `cluster` label and with what content to PodLogs logs. #7764 * [ENHANCEMENT] Produce a clearer error messages when multiple X-Scope-OrgID headers are present. #7704 * [BUGFIX] Metamonitoring: update dashboards to drop unsupported `step` parameter in targets. #7157 * [BUGFIX] Recording rules: drop rules for metrics removed in 2.0: `cortex_memcache_request_duration_seconds` and `cortex_cache_request_duration_seconds`. #7514 diff --git a/operations/helm/charts/mimir-distributed/templates/metamonitoring/pod-logs.yaml b/operations/helm/charts/mimir-distributed/templates/metamonitoring/pod-logs.yaml index 78b799dbbaa..1c6c747653c 100644 --- a/operations/helm/charts/mimir-distributed/templates/metamonitoring/pod-logs.yaml +++ b/operations/helm/charts/mimir-distributed/templates/metamonitoring/pod-logs.yaml @@ -29,8 +29,10 @@ spec: sourceLabels: - __meta_kubernetes_pod_container_name targetLabel: name + {{- if kindIs "string" .logs.clusterLabel }} - targetLabel: cluster - replacement: {{ include "mimir.clusterName" $ }} + replacement: "{{ .logs.clusterLabel | default (include "mimir.clusterName" $) }}" + {{- end }} namespaceSelector: matchNames: diff --git a/operations/helm/charts/mimir-distributed/values.yaml b/operations/helm/charts/mimir-distributed/values.yaml index 5170bd8deae..ebc8222cd0c 100644 --- a/operations/helm/charts/mimir-distributed/values.yaml +++ b/operations/helm/charts/mimir-distributed/values.yaml @@ -3213,6 +3213,11 @@ metaMonitoring: # -- Controls whether to create resources PodLogs and LogsInstance resources enabled: true + # -- To disable setting a 'cluster' label in logs, set to 'null'. + # To overwrite the 'cluster' label with your own value, set to a non-empty string. + # Keep empty string "" to have the default value in the 'cluster' label, which is the helm release name for Mimir and the actual cluster name for Enterprise Metrics. + clusterLabel: "" + # -- Default destination for logs. The config here is translated to Promtail client # configuration to write logs to this Loki-compatible remote. Optional. remote: diff --git a/operations/helm/tests/metamonitoring-values-generated/mimir-distributed/templates/metamonitoring/pod-logs.yaml b/operations/helm/tests/metamonitoring-values-generated/mimir-distributed/templates/metamonitoring/pod-logs.yaml index 51bc40a1196..7c00691bd9f 100644 --- a/operations/helm/tests/metamonitoring-values-generated/mimir-distributed/templates/metamonitoring/pod-logs.yaml +++ b/operations/helm/tests/metamonitoring-values-generated/mimir-distributed/templates/metamonitoring/pod-logs.yaml @@ -26,7 +26,7 @@ spec: - __meta_kubernetes_pod_container_name targetLabel: name - targetLabel: cluster - replacement: metamonitoring-values + replacement: "metamonitoring-values" namespaceSelector: matchNames: