# Show loki data based on prometheus query in other panel

**URL:** <https://community.grafana.com/t/show-loki-data-based-on-prometheus-query-in-other-panel/54105>\
**Category:** Grafana\
**Created:** [October 3, 2021, 1:50pm UTC](https://community.grafana.com/t/show-loki-data-based-on-prometheus-query-in-other-panel/54105 "2021-10-03T13:50:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trond1](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/trond1/32/18950_2.png) [@trond1](https://community.grafana.com/u/trond1)\
**Post date:** [October 3, 2021, 1:50pm UTC](https://community.grafana.com/t/show-loki-data-based-on-prometheus-query-in-other-panel/54105/1 "2021-10-03T13:50:08Z")

</div>

I have a dashboard with 3 variables: cluster, namespace and “app”. The two first ones are fairly standard, the last one queries the pod\_labels metric to grab available values, like this:

```auto
label_values(kube_pod_labels{cluster="$cluster", namespace="$namespace"}, label_app)

```

one panel is a prometheus metrics panel, where i display cpu usage for pods matching the label from the variable:

```auto
sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{cluster="$cluster", namespace="$namespace", container!="POD"} * on(pod) group_left(label_app) topk(1, kube_pod_labels{cluster="$cluster", namespace="$namespace", label_app="$app"}) by (pod)) by (pod, container, label_app)

```

The other panel is a loki logs panel. I want that panel to show logs from the same pods as my metrics panel is showing. Loki doesn’t have access to `kube_pod_labels` as far as I know, so I’m wondering if I can somehow send the “list of pods” from my metrics panel to the loki panel?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [October 3, 2022, 1:50pm UTC](https://community.grafana.com/t/show-loki-data-based-on-prometheus-query-in-other-panel/54105/2 "2022-10-03T13:50:17Z")

</div>

This topic was automatically closed after 365 days. New replies are no longer allowed.
