I have my data as follows:
| table envName, envAcronym, envCluster
I am using envName as Label of the dropdown but want to use envAcronym and envCluster as the value. From the dropdown editor, I dont see a way to specify multiple values. Is there a way to achieve what I am looking for?
I tried setting the value as a json object but then dereferencing the variables with dot notation does not work. For example I tried to reference value as "$selectedEnv.envAcronym$" and $selectedEnv.envCluster$ but it does not work.
Thank you @gcusello. One thing I am still not able to figure out is "where" do I run the rex command to extract the field. For example, one the dashboard panels needs the selected envCluster as follows:
| mstats avg(_value) as "Avg" where index IN(k8_metrics) cluster_name=$envCluster$ AND metric_name="kube.node.memory.usage_bytes" span=1m by node
I cannot add a rex clause before mstats as that is not allowed. I understand that it would work fine for normal search based panels where I can add rex command easily.
Hi @blueocean t,
I rarely use mstats, but probably runs:
| mstats avg(_value) as "Avg" where index IN(k8_metrics) AND metric_name="kube.node.memory.usage_bytes" span=1m by node
| rex field=$envCluster$ "^(?<envAcronym>[^\|]+)\|(?<envCluster>.*)"
| search cluster_name=envCluster
Ciao.
Giuseppe
HI @blueocean ,
you could be to use in the dropdown:
| eval value=envAcronym."|".envCluster
| table envName value
using envName as label and value as value.
then in the search you can divide the value using a regex
| rex field=value "^(?<envAcronym>[^\|]+)\|(?<envCluster>.*)"
Ciao.
Giuseppe