From e0765344a96db273ecc1ae34fd09df0b8e44d8dd Mon Sep 17 00:00:00 2001 From: Jay Beale Date: Tue, 22 Feb 2022 19:46:18 -0800 Subject: [PATCH] Adding an example (#31830) * Adding an example This text mentions that you can view the logs from a specific container by appending the container name. I've created an example, based on the previous few lines. Also, I've added a -c flag, to bring this in line with both the ```kubectl logs``` [documentation's examples](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs) and other kubectl commands that require the -c flag when selecting a specific container from a pod. * Wrapping long line and marking `-c` as code. Co-authored-by: Qiming Teng Co-authored-by: Qiming Teng --- .../en/docs/concepts/cluster-administration/logging.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/content/en/docs/concepts/cluster-administration/logging.md b/content/en/docs/concepts/cluster-administration/logging.md index fb2d37ed58..4916548a73 100644 --- a/content/en/docs/concepts/cluster-administration/logging.md +++ b/content/en/docs/concepts/cluster-administration/logging.md @@ -57,7 +57,15 @@ The output is: ... ``` -You can use `kubectl logs --previous` to retrieve logs from a previous instantiation of a container. If your pod has multiple containers, specify which container's logs you want to access by appending a container name to the command. See the [`kubectl logs` documentation](/docs/reference/generated/kubectl/kubectl-commands#logs) for more details. +You can use `kubectl logs --previous` to retrieve logs from a previous instantiation of a container. +If your pod has multiple containers, specify which container's logs you want to access by +appending a container name to the command, with a `-c` flag, like so: + +```console +kubectl logs counter -c count +``` + +See the [`kubectl logs` documentation](/docs/reference/generated/kubectl/kubectl-commands#logs) for more details. ## Logging at the node level