combine value of two lables in promtail config

How to add the values of multiple labels and assign them to another label in promtail config?

scrape_configs:
  - job_name: journal
    journal:
      max_age: 12h
    relabel_configs:
    - source_labels: ['__journal__machine_id']
      target_label: 'HostId'
    - source_labels: ['__journal__hostname']
      target_label: 'HostName'
    - source_labels: ['__journal_syslog_identifier']
      target_label: 'ApplicationName'
    pipeline_stages:
    - match:
        selector: '{ApplicationName="test-app"}'
        stages:
        - static_labels:
            OriginId: //here I want to asign HostId+HostName+ApplicationName

In the end, I expect the value of label OriginId would be HostId+HostName+ApplicationName

1 Like