I have a Kubernetes job definition yaml and am trying to get the pod logs into Datadog by making a separate service so it's easier to filter on data dog. Would it be possible to add the datadog annotations in this job definition yaml or would it have to be done at the pod level?
this is the code block I have tried but it does not work for me:
apiVersion: batch/v1
kind: Job
metadata:
name: my-job
annotations:
ad.datadoghq.com/kubernetes.logs: '[{"source": "stdout", "service": "my-job"}]'
spec:
template:
spec:
containers:
- name: my-container
image: my-image
command: ["echo", "Hello, world!"]
restartPolicy: Never
i also added the datadog variables such as DD_LOGS_ENABLED, DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL, DD_PROXY_HOST as env vars in this file as well