<p>For some reason, my Pod in k8s could possibly labeled with <code>syscode</code> or <code>cib_syscode</code>, how can I relabel both of them to <code>cib_syscode</code>? That is to say if pod labeled with one of them, choose its label value as the result.
I have tried as follow, but it doesn't work because the target_label is duplicate.</p>
<pre class="lang-yaml prettyprint-override"><code>    - job_name: ncr
      honor_labels: true
      scrape_interval: 30s
      scrape_timeout: 30s
      metrics_path: /metrics
      scheme: http
      kubernetes_sd_configs:
      - role: pod
      relabel_configs:
      - source_labels: [__meta_kubernetes_pod_label_syscode]
        separator: ;
        regex: (.*)
        target_label: cib_syscode
        replacement: ${1}
        action: replace
      - source_labels: [__meta_kubernetes_pod_label_cib_syscode]
        separator: ;
        regex: (.*)
        target_label: cib_syscode
        replacement: ${1}
        action: replace
</code></pre>
<p>Looking forward to your reply, thank you!</p>

Leslie__Joe
<p>Try the following:</p>
<pre class="lang-yaml prettyprint-override"><code>    - job_name: ncr
      honor_labels: true
      scrape_interval: 30s
      scrape_timeout: 30s
      metrics_path: /metrics
      scheme: http
      kubernetes_sd_configs:
      - role: pod
      relabel_configs:
      - source_labels: [__meta_kubernetes_pod_label_syscode, __meta_kubernetes_pod_label_cib_syscode]
        separator: ;
        regex: ([^;]+)
        target_label: cib_syscode
        replacement: ${1}
        action: replace
</code></pre>
<p>If either <code>__meta_kubernetes_pod_label_syscode</code> or <code>__meta_kubernetes_pod_label_cib_syscode</code> is set, then the regex should select its value (i.e. a continuous string not containing the separator <code>;</code>) and assign it to the <code>cib_syscode</code> target label.</p>
