mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
77 lines
2.6 KiB
Plaintext
77 lines
2.6 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * observability/logging/performance_reliability/logging-flow-control-mechanisms.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="logging-set-input-rate-limit_{context}"]
|
|
= Configuring log forwarder input rate limits
|
|
|
|
You can limit the rate of incoming logs that are collected by configuring the `ClusterLogForwarder` custom resource (CR). You can set input limits on a per-container or per-namespace basis.
|
|
|
|
.Prerequisites
|
|
|
|
* You have installed the {clo}.
|
|
* You have administrator permissions.
|
|
|
|
.Procedure
|
|
|
|
. Add a `maxRecordsPerSecond` limit value to the `ClusterLogForwarder` CR for a specified input.
|
|
+
|
|
The following examples show how to configure input rate limits for different scenarios:
|
|
+
|
|
.Example `ClusterLogForwarder` CR that sets a per-container limit for containers with certain labels
|
|
[source,yaml]
|
|
----
|
|
apiVersion: logging.openshift.io/v1
|
|
kind: ClusterLogForwarder
|
|
metadata:
|
|
# ...
|
|
spec:
|
|
# ...
|
|
inputs:
|
|
- name: <input_name> <1>
|
|
application:
|
|
selector:
|
|
matchLabels: { example: label } <2>
|
|
containerLimit:
|
|
maxRecordsPerSecond: 0 <3>
|
|
# ...
|
|
----
|
|
<1> The input name.
|
|
<2> A list of labels. If these labels match labels that are applied to a pod, the per-container limit specified in the `maxRecordsPerSecond` field is applied to those containers.
|
|
<3> Configures the rate limit. Setting the `maxRecordsPerSecond` field to `0` means that no logs are collected for the container. Setting the `maxRecordsPerSecond` field to some other value means that a maximum of that number of records per second are collected for the container.
|
|
+
|
|
.Example `ClusterLogForwarder` CR that sets a per-container limit for containers in selected namespaces
|
|
[source,yaml]
|
|
----
|
|
apiVersion: logging.openshift.io/v1
|
|
kind: ClusterLogForwarder
|
|
metadata:
|
|
# ...
|
|
spec:
|
|
# ...
|
|
inputs:
|
|
- name: <input_name> <1>
|
|
application:
|
|
namespaces: [ example-ns-1, example-ns-2 ] <2>
|
|
containerLimit:
|
|
maxRecordsPerSecond: 10 <3>
|
|
- name: <input_name>
|
|
application:
|
|
namespaces: [ test ]
|
|
containerLimit:
|
|
maxRecordsPerSecond: 1000
|
|
# ...
|
|
----
|
|
<1> The input name.
|
|
<2> A list of namespaces. The per-container limit specified in the `maxRecordsPerSecond` field is applied to all containers in the namespaces listed.
|
|
<3> Configures the rate limit. Setting the `maxRecordsPerSecond` field to `10` means that a maximum of 10 records per second are collected for each container in the namespaces listed.
|
|
|
|
. Apply the `ClusterLogForwarder` CR:
|
|
+
|
|
.Example command
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>.yaml
|
|
----
|