Rename by Regex doesn't process validated syntax

Hello All,

I’m struggling to utilize Rename by Regex for my data coming from Dynatrace api for below strings:

ext:tech.IBMMQ_Java.Queue.Depth: { Queue=ATDX01M2.CSV.NOTIFICATIONS_FROM_SYSTEM, dt.entity.custom_device=CUSTOM_DEVICE-C43C30B0FE89F372 }
ext:tech.IBMMQ_Java.Queue.Depth: { Queue=ATDX44M2.CDS.ABC.REQUESTQ, dt.entity.custom_device=CUSTOM_DEVICE-C4D1C6E4782764FB }
ext:tech.IBMMQ_Java.Queue.Depth: { Queue=ATDX01M1.CSV.ESB.ABC.XYZ_MESSAGES, dt.entity.custom_device=CUSTOM_DEVICE-57183614D438F39E }

For above strings I had multiple attempts to process them. All regex validators capture what I actually want using below expressions. Which would be:
ATDX01M2.CSV.NOTIFICATIONS_FROM_SYSTEM
ATDX44M2.CDS.ABC.REQUESTQ
ATDX01M1.CSV.ESB.ABC.XYZ_MESSAGES

But none of them seem to work in Grafana at all. It seems like they are just not finding the pattern. Can you guys point me what I’m doing wrong?

(=(.*?)(?=,|$))

=([^,]+)

=(.+?),\s*

Hi @dariuszmoskal,
Try with this regex:

.*Queue=([^\,].*),.*

Breakdown of regex:

  • .* -> matches any symbol
  • Queue= -> after any symbol there must be string "Queue="
  • ( -> starts matching group
  • [^\,].* -> matches every symbol till symbol ","
  • ) -> closes matching group
  • , -> after matching group there must be symbol ",". This is important to match only till first "," (otherwise you would match till last "," which is at the end of string
  • .* -> means that after "," can by any string

Here is a direct link to regex101 with your data and regex (with green color is marked Group 1 which is part you want to extract):

This site is great for checking what regex would match. Important to note is that Grafana uses Golang flavour of regex (specified in left menu).

 

Best regards,
ldrascic

Thanks a lot for such a quick and proffesional response! It works like charm for my needs. I was probably using Syntax not supported by Golang hence my issues.

Thanks again!