Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29245

Using regular expressions in Prometheus relabel_configs source_labels

$
0
0

I'm trying to save the meta labels retrieved from EC2 Service Discovery as target labels. I'm mostly concerned about the tags - every instance contains a lot of them and I would love to gather them all using one simple configuration entry with the usage of regular expression.

The perfect solution seems to be something like this:

relabel_configs:
   - source_labels:
      - '__meta_ec2_tag_(.*)'
     target_label: '### use extracted regex group here'

Unfortunately, I get the following error:

\"__meta_ec2_tag_(.*)\" is not a valid label name"

Does that mean that I can't use regular expressions to describe source labels and that I have to specify each source label separately like in the sample below?

- source_labels:
    - '__meta_ec2_tag_Name'
  target_label: 'instance_name'

- source_labels:
    - '__meta_ec2_tag_environment'
  target_label: 'environment'

- source_labels:
    - '__meta_ec2_tag_project'
  target_label: 'project'

Viewing all articles
Browse latest Browse all 29245

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>