In this tutorial, you'll learn how to
This article is intended for
Set up ingestion of Kubernetes audit logs, for example, through Amazon Firehose. Firehose can be used to ship logs from Amazon Elastic Kubernetes Service (EKS), but the provided template is compatible with any Kubernetes distribution.
Generate an access token with the openpipeline.events_security
scope to allow us to ingest detection findings. To later access the token securely from within a workflow, store the token in the credential vault. For details, see Dynatrace API - Tokens and authentication.
After setting up log ingestion, you can start detecting threats.
Use Workflows to execute DQL queries regularly and look for suspicious behavior in your data.
Import our workflow template.
For the execute_query step, adapt the DQL query to your needs.
The template query aims to find possibly compromised service accounts within our Kubernetes cluster.
For the ingest_findings step, go to Input > Authentication and select the token previously stored in the credential vault.
To trigger a detection finding based on the query provided, execute the following commands in a Dynatrace-monitored Kubernetes cluster:
Create a test service account:
kubectl create serviceaccount test-sa -n default
Attempt unauthorized access (should trigger detection):
kubectl --as=system:serviceaccount:default:test-sa get secret -A
You can define exceptions to the rule by adding allowlisting criteria to the apply_allowlist step in the workflow.
A detection finding event will not be created if all attributes of an entry match those of any single allowlisted entry.
AND
logic within an entry.OR
logic across entries.Use Threats & Exploits to examine and prioritize the detection findings created. The rich observability context provided in the detection finding enables fast analysis and confident assessment of the situation.
Sample result
Dynatrace provides ready-to-use workflow templates that automatically trigger on new Kubernetes threat detection findings and send notifications via Slack, Microsoft Teams, or Email. Use these as starting points to build your own automated response workflows:
Instant notification for critical Kubernetes detection findings: Triggers on high or critical findings and alerts the responsible team.
Threat detection notification sender: A reusable sub-workflow for centralized notification delivery.
These templates show how to enrich findings with ownership context and integrate real-time alerting into your response workflows.
Workflows enable precise threat detection and response aligned with your environment’s context. Features like flexible scheduling, DQL-based filtering, allowlisting, ownership tagging, and notification integration allow for rapid, low-noise detection. The included blueprint offers a modular starting point that can be fine-tuned or extended to meet specific operational needs.