Skip to content

Commit 9b02d41

Browse files
authored
Add correct source for EKS audit logs and scheduler logs (DataDog#406)
1 parent 4dab186 commit 9b02d41

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

aws/logs_monitoring/lambda_function.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,16 @@ def awslogs_handler(event, context, metadata):
960960
if not env_tag_exists:
961961
metadata[DD_CUSTOM_TAGS] += ",env:none"
962962

963+
# The EKS log group contains various sources from the K8S control plane.
964+
# In order to have these automatically trigger the correct pipelines they
965+
# need to send their events with the correct log source.
966+
if metadata[DD_SOURCE] == "eks":
967+
if logs["logStream"].startswith("kube-apiserver-audit-"):
968+
metadata[DD_SOURCE] = "kubernetes.audit"
969+
elif logs["logStream"].startswith("kube-scheduler-"):
970+
metadata[DD_SOURCE] = "kube_scheduler"
971+
# In case the conditions above don't match we maintain eks as the source
972+
963973
# Create and send structured logs to Datadog
964974
for log in logs["logEvents"]:
965975
yield merge_dicts(log, aws_attributes)

0 commit comments

Comments
 (0)