Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([^;,\n]*);.*(\b\1\b=|;)(true)(,.*)?$
/
gm

Description

relabel_configs:
  # only probe services with probe set, both of the following annotations are supported:
  #   metrics.agent.grafana.com/scrape: true
  #   prometheus.io/scrape: true
  #   or 
  #   metrics.agent.grafana.com/scrape: http-metrics=true,grpc=false
  #   prometheus.io/scrape: http-metrics=true,grpc=false
  - action: keep
    source_labels:
      - __meta_kubernetes_service_port_name
      - __meta_kubernetes_service_annotation_prometheus_io_probe
      - __meta_kubernetes_service_annotation_metrics_agent_grafana_com_probe
    separator: ;
    regex: ^([^;,\n]*);.*?(\b\1\b=|;)(true)(;.+|$)
Submitted by AaronB - a year ago (Last modified a year ago)