You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/concepts/cluster-administration/logging.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,11 +71,12 @@ You can use `kubectl logs --previous` to retrieve logs from a previous instantia
71
71
If your pod has multiple containers, specify which container's logs you want to access by
72
72
appending a container name to the command, with a `-c` flag, like so:
73
73
74
-
```console
74
+
```shell
75
75
kubectl logs counter -c count
76
76
```
77
77
78
-
See the [`kubectl logs` documentation](/docs/reference/generated/kubectl/kubectl-commands#logs) for more details.
78
+
See the [`kubectl logs` documentation](/docs/reference/generated/kubectl/kubectl-commands#logs)
79
+
for more details.
79
80
80
81
### How nodes handle container logs
81
82
@@ -98,23 +99,23 @@ The usual way to access this is by running `kubectl logs`.
98
99
99
100
You can configure the kubelet to rotate logs automatically.
100
101
101
-
If you configure rotation, the kubelet is responsible for rotating container logs and managing the logging directory structure.
102
+
If you configure rotation, the kubelet is responsible for rotating container logs and managing the
103
+
logging directory structure.
102
104
The kubelet sends this information to the container runtime (using CRI),
103
105
and the runtime writes the container logs to the given location.
104
106
105
107
You can configure two kubelet [configuration settings](/docs/reference/config-api/kubelet-config.v1beta1/),
106
108
`containerLogMaxSize` and `containerLogMaxFiles`,
107
109
using the [kubelet configuration file](/docs/tasks/administer-cluster/kubelet-config-file/).
108
-
These settings let you configure the maximum size for each log file and the maximum number of files allowed for each container respectively.
110
+
These settings let you configure the maximum size for each log file and the maximum number of
111
+
files allowed for each container respectively.
109
112
110
113
When you run [`kubectl logs`](/docs/reference/generated/kubectl/kubectl-commands#logs) as in
111
114
the basic logging example, the kubelet on the node handles the request and
112
115
reads directly from the log file. The kubelet returns the content of the log file.
113
116
114
-
115
117
{{< note >}}
116
-
Only the contents of the latest log file are available through
117
-
`kubectl logs`.
118
+
Only the contents of the latest log file are available through `kubectl logs`.
118
119
119
120
For example, if a Pod writes 40 MiB of logs and the kubelet rotates logs
120
121
after 10 MiB, running `kubectl logs` returns at most 10MiB of data.
@@ -220,7 +221,8 @@ application containers on that node.
220
221
Because the logging agent must run on every node, it is recommended to run the agent
221
222
as a `DaemonSet`.
222
223
223
-
Node-level logging creates only one agent per node and doesn't require any changes to the applications running on the node.
224
+
Node-level logging creates only one agent per node and doesn't require any changes to the
225
+
applications running on the node.
224
226
225
227
Containers write to stdout and stderr, but with no agreed format. A node-level agent collects
226
228
these logs and forwards them for aggregation.
@@ -230,7 +232,8 @@ these logs and forwards them for aggregation.
230
232
You can use a sidecar container in one of the following ways:
231
233
232
234
* The sidecar container streams application logs to its own `stdout`.
233
-
* The sidecar container runs a logging agent, which is configured to pick up logs from an application container.
235
+
* The sidecar container runs a logging agent, which is configured to pick up logs
236
+
from an application container.
234
237
235
238
#### Streaming sidecar container
236
239
@@ -345,10 +348,13 @@ The pod mounts a volume where fluentd can pick up its configuration data.
345
348
346
349

347
350
348
-
Cluster-logging that exposes or pushes logs directly from every application is outside the scope of Kubernetes.
351
+
Cluster-logging that exposes or pushes logs directly from every application is outside the scope
352
+
of Kubernetes.
349
353
350
354
## {{% heading "whatsnext" %}}
351
355
352
356
* Read about [Kubernetes system logs](/docs/concepts/cluster-administration/system-logs/)
353
357
* Learn about [Traces For Kubernetes System Components](/docs/concepts/cluster-administration/system-traces/)
354
-
* Learn how to [customise the termination message](/docs/tasks/debug/debug-application/determine-reason-pod-failure/#customizing-the-termination-message) that Kubernetes records when a Pod fails
358
+
* Learn how to [customise the termination message](/docs/tasks/debug/debug-application/determine-reason-pod-failure/#customizing-the-termination-message)
0 commit comments