Log collection
Log Collection is the process of gathering and storing output data, known as logs, generated by containers running within Kubernetes pods. These logs contain important information about the behavior, performance, and status of applications and system components. By collecting these logs, administrators and developers can monitor activities within the cluster, troubleshoot issues, analyze system performance, and ensure smooth operation and security across the Kubernetes environment.
Collecting container logs based on pod annotations
Kubernetes Pod annotations used to mark pods as a target for log collection. Set true to enable log collection for the container inside the pod. You can add the following annotation:
observability.cloudeka.ai/logs: “true”
There are two ways to enable log collection:
1. Through pod definition: Annotate workloads (e.g., Deployment) to enable log collection:
spec:
template:
metadata:
annotations:
observability.cloudeka.ai/logs: "true"
Through running pods: This is a temporary method that works on running pods. The annotation will be reverted after the pod is rolled out or restarted.
kubectl -n <namespace> annotate pod <pod_name> observability.cloudeka.ai/logs=true
Last updated