cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding K8s labels to log lines

gilgi
DynaMight Champion
DynaMight Champion

Hi All, 

We have a use case in which we want to add the value of a specific k8s workload label to the log lines of the relevant pods. My questions is actually very simple: on which grail "table" is it stored?

Gil.

1 REPLY 1

LawrenceBarratt
Dynatrace Advisor
Dynatrace Advisor

Hi @gilgi 

The Workloads are within dt.entity.cloud_application, and pods are stored in dt.entity.cloud_application_instance

Reflecting part of the URL when you're in a workload and a pod.

This DQL I am looking for a specific label from the Workload "control-plane"

fetch dt.entity.cloud_application_instance
|fields entity.name,id,workloadName
| lookup sourceField:workloadName, lookupField:entity.name, [fetch dt.entity.cloud_application
| expand cloudApplicationLabels[`control-plane`], alias:controlPlane]
| filter isNotNull(lookup.controlPlane)

Thanks,

Lawrence

Featured Posts