From f867c1fd58c6ef0d8061d71089193de7b9598c9f Mon Sep 17 00:00:00 2001 From: Matti Savolainen Date: Wed, 19 Oct 2016 13:31:55 +0300 Subject: [PATCH] formating and text fixes, adjust regexp --- config/config.go | 6 +++--- config/testdata/conf.good.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 7b63c4061..2a9918712 100644 --- a/config/config.go +++ b/config/config.go @@ -31,7 +31,7 @@ var ( patFileSDName = regexp.MustCompile(`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$`) patRulePath = regexp.MustCompile(`^[^*]*(\*[^/]*)?$`) patAuthLine = regexp.MustCompile(`((?:password|bearer_token|secret_key|client_secret):\s+)(".+"|'.+'|[^\s]+)`) - relabelTarget = regexp.MustCompile(`^(?:(?:[a-zA-Z_]|\$\{?[\w]+\}?)+\w*)+$`) + relabelTarget = regexp.MustCompile(`^(?:(?:[a-zA-Z_]|\$(?:\{\w+\}|\w+))+\w*)+$`) ) // Load parses the YAML input s into a Config. @@ -987,8 +987,8 @@ type RelabelConfig struct { Regex Regexp `yaml:"regex,omitempty"` // Modulus to take of the hash of concatenated values from the source labels. Modulus uint64 `yaml:"modulus,omitempty"` - // The label to which the resulting string is written in a replacement. - // regex interpolation is allowed for the replace action. + // TargetLabel is the label to which the resulting string is written in a replacement. + // Regexp interpolation is allowed for the replace action. TargetLabel string `yaml:"target_label,omitempty"` // Replacement is the regex replacement pattern to be used. Replacement string `yaml:"replacement,omitempty"` diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml index ab38a56fa..a075a3dfe 100644 --- a/config/testdata/conf.good.yml +++ b/config/testdata/conf.good.yml @@ -106,7 +106,7 @@ scrape_configs: relabel_configs: - source_labels: [__meta_sd_consul_tags] - separator: ',' + separator: ',' regex: label:([^=]+)=([^,]+) target_label: ${1} replacement: ${2}