Hi @alex23,
You can extract only string in square brackets by using Grafana transformation Rename by regex
. Please take a look at this post for more information:
Regex that would do the job in your case would be:
.*\[([^\]]*)\].*
And in Replace
field you would use $1
.
Regex breakdown:
.*\[
- means match all till first literal symbol [
([^\]]*)
- captures all strings that are inside square brackets. It matches everything till first ]. Mathed result is in group $1. Each time you specify round brackets ()
you get one more group (e.g $2, $3, $4…)
\].*
- means tha there must be literal symbol ] and after that can be any number of any symbols
Tested on regex101:
Best regards,
ldrascic