On Wednesday, 27 May 2020 09:07:05 UTC+1, Anna Chekhovskikh wrote:
>
> I checked your solution, it works, but I need to strip off all _before_ 
> last slash.
>

- source_labels: [__address__]
  regex: '.*/(.*)'
  replacement: '$1'     # this is the default anyway
  target_label: store

The regular expression "captures" sections in parentheses.  $1 is the first 
parenthesised subexpression, $2 is the second etc.  So it could also be 
written:

- source_labels: [__address__]
  regex: '(.*)/(.*)'
  replacement: '$2'
  target_label: store

Regexps are "greedy" by default, so aaa/bbb/ccc will be matched as 
(aaa/bbb) / (ccc) 


And if I change your regex to mine, I can't see the new label.
>
>
You'll need to show your regex, and an example of the input you're trying 
to match against it, and what you would like to see as the output.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/5d9d77f2-2539-4ede-8897-05a6881bb80c%40googlegroups.com.

Reply via email to