what api can be used to get events from all pods from a kubernetes cluster?

what api can be used to get events from all pods from a kubernetes cluster?

Hi,

I would check Events API v2.

Best regards

Hi @AntonPineiro

I tested the following API endpoint to retrieve Kubernetes-related events:

{{baseUrl}}/it_prod-dynatrace-environment-apac/v2/events?entitySelector=entityId(KUBERNETES_CLUSTER-0FB79669080C9DD5)&from=now-60d&to=now&pageSize=500
Observation:

The query successfully returns events for the Kubernetes cluster (KUBERNETES_CLUSTER-0FB79669080C9DD5).
However, no events for individual Kubernetes pods are included in the response.

Use DQL:

fetch events
| filter k8s.cluster.name == "mycluster"
| filter event.provider == "KUBERNETES_EVENT" or event.provider == "KUBERNETES_INFERRED_EVENT"

And use the platform /platform/storage/query/v1 API , see Access platform APIs from outside | Dynatrace Developer on how to access it.

Or use dtctl insted which might be much easier to use.

@Julius_Loman I’m using dynatrace classic, how can I use this query?

With Dynatrace Classic or Dynatrace Managed you are left with the Events API that @AntonPineiro  suggested.
You need to select events from workloads running in the kubernetes cluster and you must adjust entitySelector accordingly.