- What Grafana version and what operating system are you using?
v8.5.5 (d32ae18909), Linux (it’s self hosted, but I don’t have access to the machine to dive deeper)
- What are you trying to achieve?
I have an Infinity data source which pulls JSON from an API. This JSON contains a number of objects. These objects can have an optional XML part named “xmlForFile”. I am trying to extract the first child “asset_name” from it and show it in the table view instead of the whole XML.
- How are you trying to achieve it?
Added a field override for the field. Used value mappings with regex to extract the value.
Fiddled around with several approaches of regex patterns which I developed on regex101 (Golang flavour).
- What happened?
Well…basically nothing. The AssetName field still shows the original data.
Tried the same approach with another field. It (ImageId) just contains a plain text filename from which I extract the number in the middle. This one works fine.
- What did you expect to happen?
Show the filename of the asset_name child.
- Can you copy/paste the configuration(s) that you are having problems with?
I even made an example dashboard:
https://play.grafana.org/d/dd1082a7-4fd1-40b7-a95a-f37620c4e2f1/regex-overrides-value-mappings-1
Tell me if this is not enough or if more permissions are needed…
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No.
- Did you follow any online instructions? If so, what is the URL?
I’m very new to this and I am still learning the thing and all the terms and such. So far, I could solve most of my problems with the help of the documentation, Google, StackOverflow and this community.
Small addition to the above: I’m not sure if my regex patterns are correct. They do work when I try them on regex101.com. But you never know. Another thing: the XML is obviously json-encoded. But I’m not sure how the field is interpreted internally. If it gets json-decoded somehow or not. I tried patterns for both scenarios. None of them worked. So I’m more and more thinking that it’s either really not working due to a bug or I am making a basic mistake.