How to Rename by ReGex a field value after applying Labels to fields?

Hello there!

  • What Grafana version and what operating system are you using?
    I am running Grafana 9.3.6.

  • What are you trying to achieve?
    I want to rename the values of one of the columns of my rows using a RegEx expression.
    But I also applied the transform “Labels to fields”.

  • How are you trying to achieve it?
    I tried using Rename by regex transformation but instead of renaming the values it renames the table header.

I also tried using Field override called Fields with name matching regex like this:
Fields with name matching regex: /./
Value mapping: ^Status do Serviço\s.(.
) ABC

image

  • What happened?
    It did not work.

  • What did you expect to happen?
    Rename my service names in the rows, it’s the values from the first column.

  • Can you copy/paste the configuration(s) that you are having problems with?
    I am currently trying:

Rename by regex after applying Labels to fields.
Override using Fields and value mappings using RegEx.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors received on the UI or related logs.

  • Did you follow any online instructions? If so, what is the URL?
    Yes. I followed the same forums and instructions:

https://localhost:3000/t/variable-with-value-mappings/24543/10

https://localhost:3000/t/need-help-with-override-field-name-with-regex/73843
https://localhost:3000/t/overrides-value-mappings-regex-not-working/55199

@horselessname using value mappings as mentioned in How to Rename Values in Grafana Using Regex-Based Value Mapping is the way to do this.

The transform will change the field name, but not the values. I see you tried using an override with a value mapping. To rename a value you want to select the field name Service Name in the drop-down for Fields with name. Then, add the value mapping override for the field values that you want to rename.

1 Like

I literally googled Grafana RegEx Replace and just got to my own question. I did not remember that I went through this already and you gave me a solution previously hahah.

Thank you, It worked.

1 Like