---
title: "Get logs for a Kubernetes pod"
method: GET
path: "/kubernetes/{id}/namespaces/{namespace}/pods/{name}/log"
tags: ["kubernetes"]
---

# Get logs for a Kubernetes pod

`GET /kubernetes/{id}/namespaces/{namespace}/pods/{name}/log`

Stream the logs for a pod in the given namespace as text/plain. When
follow is set the response stays open and emits new log lines until the
client disconnects. When the pod has more than one container, the
container query parameter is required.
**Access policy**: Authenticated user.

## Path parameters

- `id` integer, required
- `namespace` string, required
- `name` string, required

## Query parameters

- `container` string
- `tailLines` integer
- `sinceSeconds` integer
- `timestamps` boolean
- `previous` boolean
- `follow` boolean

## Response `200`

Success

## Other responses

- `400` — Invalid request payload, such as missing required fields or fields not meeting validation criteria.
- `401` — Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions.
- `403` — Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions.
- `500` — Server error occurred while attempting to retrieve the pod logs.

## Changes

- **2026-08-07** `ec51a8194ac0` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/portainer/apis/portainerce-api/changes/kubernetes/:id/namespaces/:namespace/pods/:name/log/get.md)

---

[API](https://skmtc.dev/portainer/apis/portainerce-api.md) · [All operations](https://skmtc.dev/portainer/apis/portainerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/portainer/portainerce-api/revisions/6d8f5cab4e5a/schema)
