Display substring of value

  • What Grafana version and what operating system are you using?
    Grafana v9.5.3 (916d9793aa)

  • What are you trying to achieve?
    trying to change how query results are displayed


    I would like to strip the prefix for image names up until ‘:’ and only display the tag part, just for the sake of saving screen estate.

  • How are you trying to achieve it?
    I’ve looked into transformations, and field overrides

  • What happened?
    It seems I’m looking in the wrong places, or can’t figure out how to achieve this

  • What did you expect to happen?
    I expect that I can use some substring or regex function to only display the part of the value I am interested in.

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

{container="cloud-scanner", container_id="containerd://d3c837a9c0799c1e184d5fa3b42a59b50b5f803c1bced7e595c75a88c5820a67", endpoint="http", image="mydearcr.azurecr.io/cloud-scanner:1.0.105", image_id="mydearcr.azurecr.io/cloud-scanner@sha256:e39ef666a2284a64654a4e6259712a7f6ff7af16f28a5a0eac77fed82576b611", image_spec="mydearcr.azurecr.io/cloud-scanner:1.0.105", instance="10.255.37.102:8080", job="kube-state-metrics", namespace="cloud-scanner", pod="cloud-scanner-995b67bbd-d5hkm", service="kube-prometheus-stack-kube-state-metrics", uid="0778f5eb-b0a7-47ff-ab83-f3ed6ddcc971"}
{container="config-api", container_id="containerd://64f8743618efab4f6eaf16cfb68f95d6aa9e57e9e425bdd7b51f8fbddf24191d", endpoint="http", image="mydearcr.azurecr.io/config-api:1.0.113", image_id="mydearcr.azurecr.io/config-api@sha256:d3c6f7e15307f5e1f42b16ee58d30319980cb1291c5db8a468b25f073785e65a", image_spec="mydearcr.azurecr.io/config-api:1.0.113", instance="10.255.37.102:8080", job="kube-state-metrics", namespace="config-api", pod="config-api-7cd565d55d-clblh", service="kube-prometheus-stack-kube-state-metrics", uid="ff01dc8b-b57d-402b-9a30-111f67c4cc4f"}
  • Did you follow any online instructions? If so, what is the URL?
    Have not found relevant instructions.

What is your data source?
might want to look into regex transformation

data source is prometheus

use regex. let us know when you are stuck with the reg you try

I am having the exact same problem. It seems that the regex only matches the field names and not its values. I am using the “Rename by regex” transformation.

What mail6ab3 said, I can see no way to rename values, only the column names.
edit:
I was able to do it with value mappings (based on this thread):