# kubernetes logs in DQL by cluster name

**URL:** <https://community.dynatrace.com/t/kubernetes-logs-in-dql-by-cluster-name/48755>\
**Category:** DQL\
**Tags:** dql, aws, eks, kubernetes, logs\
**Created:** [November 6, 2024, 3:59am UTC](https://community.dynatrace.com/t/kubernetes-logs-in-dql-by-cluster-name/48755 "2024-11-06T03:59:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roberto\_camp1](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@roberto\_camp1](https://community.dynatrace.com/u/roberto_camp1)\
**Post date:** [November 6, 2024, 3:59am UTC](https://community.dynatrace.com/t/kubernetes-logs-in-dql-by-cluster-name/48755/1 "2024-11-06T03:59:21Z")

</div>

I have a dashboard for AWS EKS clusters where all the tiles are dependent on a $Cluster variable that contains the cluster name in the format derived from DQL:

fetch dt.entity.kubernetes\_cluster  
| fields entity.name  
| filter contains(entity.name, “engineering”)  
| sort entity.name asc

This gives me cluster names such as “engineering-east1” , “engineering-east2” etc.

I want to pin a tile to the top of the dashboard that executes this log query (got this from the kubernetes app):

fetch logs  
| filter dt.entity.kubernetes\_cluster == “KUBERNETES\_CLUSTER-986F4E539E5EE209” or in(dt.entity.kubernetes\_cluster, “KUBERNETES\_CLUSTER-986F4E539E5EE209”)  
| filter status == “ERROR” OR status == “WARN”  
| sort timestamp desc

The issue is that I would like to fetch the logs using that same $Cluster name that I’ve established in the dashboard variable, which is the entity.name from the&nbsp;dt.entity.kubernetes\_cluster, instead of the&nbsp;KUBERNETES\_CLUSTER string.&nbsp; &nbsp;I have not been able to perform any sort of lookup (ie swap in entity.name for the KUBERNETES\_CLUSTER string)&nbsp; in the fetch logs that would allow me to fetch the logs like that.&nbsp; Does anyone know how I would do this?

---

<div class="post-metadata">

**Author:** ![DavidRitter](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/davidritter/32/10328_2.png) [@DavidRitter](https://community.dynatrace.com/u/DavidRitter)\
**Post date:** [November 7, 2024, 2:22pm UTC](https://community.dynatrace.com/t/kubernetes-logs-in-dql-by-cluster-name/48755/2 "2024-11-07T14:22:58Z")

</div>

Could you replace&nbsp;dt.entity.kubernetes\_cluster with k8s.cluster.name?

Does the following query work for you?

```markup
fetch logs
| filter k8s.cluster.name == $Cluster or in(k8s.cluster.name, $Cluster)
| filter status == "ERROR" OR status == "WARN"
| sort timestamp desc

```
