get_pod_logs
Retrieve diagnostically relevant log lines from a Kubernetes pod. Filter by grep pattern, tail lines, or previous container to troubleshoot errors, panics, and warnings.
Instructions
Use only after narrowing to a specific Pod/container. Returns diagnostically relevant log lines (errors, panics, stack traces, warnings) or falls back to recent tail lines. Set grep to server-side filter like kubectl logs | grep PATTERN when you know an error string, request path, service name, or trace id. For broad incidents, first use issues, get_dashboard, search, list_resources, or get_neighborhood to avoid reading logs from many unrelated pods. If the target is a config value, feature flag, CRD field, env ref, or YAML/spec content, use search rather than logs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | Yes | pod namespace | |
| name | Yes | pod name | |
| container | No | container name, defaults to first container | |
| tail_lines | No | number of lines to fetch from the end (default 200) | |
| grep | No | optional regular expression to keep matching log lines before diagnostic filtering, like kubectl logs | grep PATTERN | |
| since | No | only return logs newer than this duration (e.g. 30s, 10m, 1h), like kubectl logs --since | |
| previous | No | return logs from the previous terminated container instance (e.g. for CrashLoopBackOff diagnosis), like kubectl logs -p |