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

&#x20;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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudeka.ai/guidance-for-individual/deka-gpu/deka-gpu-log-collection/log-collection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
