get_pod_logs
Read a pod's container logs: the normal way to see what a workload has printed, for any question about its output, not only failures. Streams live from the cluster through its agent - never a cache - with the newest lines last. Use tail_lines to bound the read, container to pick one container of a multi-container pod, and previous=true for the log of the container instance that DIED, which is what explains a CrashLoopBackOff. For history across restarts or many pods at once, use query_logs. If the cluster is offline or has no agent this refuses rather than returning stale output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pod_name | Yes | Name of the pod to fetch logs from. | |
| previous | No | Read the PREVIOUS container instance's log instead of the current one (kubectl logs --previous). This is what shows why a CrashLoopBackOff pod died, since the current instance has usually not started. Needs a cluster agent on 2.1.1058 or newer: on an older agent the call is REFUSED naming the version, never answered with the current instance's log. A container that has never restarted has no previous log; the answer says so and names the containers that have one. | |
| container | No | Specific container name if the pod has multiple containers. | |
| namespace | Yes | Kubernetes namespace where the pod is located. | |
| cluster_id | Yes | Ankra cluster id (UUID) the call targets. Discover ids with list_clusters. | |
| tail_lines | No | Number of lines from the end of the logs to return. |