Rename column value using regex

I want to rename the column data from tracking_trackingdata_2022_jan to 2022 Jan by removing tracking_trackingdata_ from the beginning.

There is a row tracking_trackingdata_default for which I just want to keep default by removing other strings.

Tabular data

with regex value (default|(\d{4}_\w{3}))$

  • What happened?
    Value is not renaming as expected

  • What did you expect to happen?
    The value should be renamed.

  • Can you copy/paste the configuration(s) that you are having problems with?

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

  • Did you follow any online instructions? If so, what is the URL?

Did you try Rename by Regex in transform tab.
And in the replace ,leave a will see 2022_jan.
again add one more time, rename by regex and now this time replace _ by space.

This regex is not working for me. Please note I’m using datasource from a different panel in the dashboard.

Can you share screenshot of what you have tried?.It doesn’t matter you can change apply regex in original panel or in this panel.

Please see the screenshot

What is your data source?

Datasource is another panel in the dashboard, whose data source is PostgreSQL

Instead of regex to change those names use some postgres function to rename and clean up those data poihts

Replace function for example

@yosiasz Thanks for the suggestion. But we can’t use the Postgres function to replace it because the same panel is also used in another panel where the exact value is required.

One way is to write a Postgres query for this panel separately, which is not something I’m interested in, as I already have data in one panel that can be used, instead of running an additional query.

1 Like

How are you doing this?