Flux Group queries are named as columns. How to rename grouped data

This is the query i run:

from(bucket: "PROD")
  |> range(start: -40m, stop: -30m)
  |> filter(fn: (r) => r["_measurement"] == "logging")
  |> filter(fn: (r) => r["_field"] == "type" or r["_field"] == "log" or r["_field"] == "ip")
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> group(columns: ["ip"], mode:"by")

The data in Grafana is grouped, however the group names are all the same: “_measurement, ip, log, type”.

I can not figure out how to rename these group names to show in the drop down as “X.X.X.X” like correct IP addresses.

Basically the questions are:

  • which variable does Grafana use to display group names
  • how to modify / rename the groups / the variable for Grafana to show correct groups.

Thank you.