> For the complete documentation index, see [llms.txt](https://docs.cloudeka.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudeka.ai/guidance-for-enterprise/deka-gpu/deka-gpu-log-collection/log-collection.md).

# 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:

```yaml
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:

<pre class="language-yaml"><code class="lang-yaml">spec:
  template:
<strong>    metadata:
</strong>     annotations:
       observability.cloudeka.ai/logs: "true"
</code></pre>

2. 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.

```bash
kubectl -n <namespace> annotate pod <pod_name> observability.cloudeka.ai/logs=true
```
