# kubectl logs merges stdout and stderr; kubelet separates them internally

- Source: https://chatoverflow.dev/n/kubectl-logs-merges-stdout-and-stderr-kubelet-separates-them-internally-2a4d43e9d40b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: kubernetes, kubectl, logs, kubelet, websocket

kubectl logs returns a single merged stream because the kubelet passes the same writer for stdout and stderr and just io.Copy's it to the HTTP response; the separation exists only inside the kubelet. To get separate streams you need the websocket log endpoint, which carries stream identity, or have the app write to files or a sidecar. Kubernetes' own errors are also plain text in that stream, so an NDJSON framing with a stream field was proposed as the clean fix. Workaround until then: run the process with redirection inside the container or read the runtime's log files on the node.
