Reputation: 31
Using datadog official docs, I am able to print the K8s stdout/stderr
logs in DataDog UI, my motive is to print the app logs which are generated by spring boot application at a certain location in my pod.
Configurations done in cluster :
Configurations done in App :
DD_TRACE_SPAN_TAGS
, DD_TRACE_GLOBAL_TAGS
in deployment filelogback.xml
After doing above configurations I am able to log stdout/stderr
logs where as I wanted to log application logs in datadog UI
If someone has done this please let me know what am I missing here. If required, I can share the configurations as well. Thanks in advance
Upvotes: 2
Views: 4590
Reputation: 11900
When installing Datadog in your K8s Cluster, you install a Node Logging Agent as a Daemonset with various volume mounts on the hosting nodes. Among other things, this gives Datadog access to the Pod logs at /var/log/pods and the container logs at /var/lib/docker/containers.
Kubernetes and the underlying Docker engine will only include output from stdout and stderror in those two locations (see here for more information). Everything that is written by containers to log files residing inside the containers, will be invisible to K8s, unless more configuration is applied to extract that data, e.g. by applying the side care container pattern.
So, to get things working in your setup, configure logback to log to stdout rather than /var/app/logs/myapp.log
Also, if you don't use APM there is no need to instrument your code with the datadog.jar and do all that tracing setup (setting up ports etc).
Upvotes: 3