1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/logging-input-spec-filter-namespace-container.adoc
Satyajeet Munje cc94fd4ee0 OBSDOCS-693
2024-04-24 18:11:38 +00:00

57 lines
1.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * observability/logging/performance_reliability/logging-input-spec-filtering.adoc
:_mod-docs-content-type: PROCEDURE
[id="logging-input-spec-filter-namespace-container_{context}"]
= Filtering application logs at input by including or excluding the namespace or container name
You can include or exclude the application logs based on the namespace and container name by using the `input` selector.
.Prerequisites
* You have installed the {clo}.
* You have administrator permissions.
* You have created a `ClusterLogForwarder` custom resource (CR).
.Procedure
. Add a configuration to include or exclude the namespace and container names in the `ClusterLogForwarder` CR.
+
The following example shows how to configure the `ClusterLogForwarder` CR to include or exclude namespaces and container names:
+
.Example `ClusterLogForwarder` CR
[source,yaml]
----
apiVersion: "logging.openshift.io/v1"
kind: ClusterLogForwarder
# ...
spec:
inputs:
- name: mylogs
application:
includes:
- namespace: "my-project" # <1>
container: "my-container" # <2>
excludes:
- container: "other-container*" # <3>
namespace: "other-namespace" # <4>
# ...
----
<1> Specifies that the logs are only collected from these namespaces.
<2> Specifies that the logs are only collected from these containers.
<3> Specifies the pattern of namespaces to ignore when collecting the logs.
<4> Specifies the set of containers to ignore when collecting the logs.
. Apply the `ClusterLogForwarder` CR by running the following command:
+
[source,terminal]
----
$ oc apply -f <filename>.yaml
----
[NOTE]
====
The `excludes` option takes precedence over `includes`.
====