// Module included in the following assemblies:
//
// * observability/logging/logging-6.0/log6x-clf.adoc

:_mod-docs-content-type: PROCEDURE
[id="log6x-input-spec-filter-labels-expressions_{context}"]
= Filtering application logs at input by including the label expressions or a matching label key and values

You can include the application logs based on the label expressions or a matching label key and its values by using the `input` selector.

.Procedure

. Add a configuration for a filter to the `input` spec in the `ClusterLogForwarder` CR.
+
The following example shows how to configure the `ClusterLogForwarder` CR to include logs based on label expressions or matched label key/values:
+
.Example `ClusterLogForwarder` CR
[source,yaml]
----
apiVersion: observability.openshift.io/v1
kind: ClusterLogForwarder
# ...
spec:
  serviceAccount:
    name: <service_account_name>
  inputs:
    - name: mylogs
      application:
        selector:
          matchExpressions:
          - key: env # <1>
            operator: In # <2>
            values: ["prod", "qa"] # <3>
          - key: zone
            operator: NotIn
            values: ["east", "west"]
          matchLabels: # <4>
            app: one
            name: app1
      type: application
# ...
----
<1> Specifies the label key to match.
<2> Specifies the operator. Valid values include: `In`, `NotIn`, `Exists`, and `DoesNotExist`.
<3> Specifies an array of string values. If the `operator` value is either `Exists` or `DoesNotExist`, the value array must be empty.
<4> Specifies an exact key or value mapping.

. Apply the `ClusterLogForwarder` CR by running the following command:

+
[source,terminal]
----
$ oc apply -f <filename>.yaml
----
