<p>I have a cluster with many namespaces.
I'm trying to log data from a specific namespace in my Openshift cluster but it is logging the data from all the namespaces. I tried to follow the documentation of the Openshift regarding logging, but there is no mention of scoping the log data.</p>
<p>I followed this documentation:
<a href="https://docs.openshift.com/container-platform/4.7/logging/cluster-logging.html" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/4.7/logging/cluster-logging.html</a></p>
<p>I'm using <code>fluentd</code> as the log collector.</p>

Akhil Ravindran
<p>As Cluster Logging on OpenShift, you can transfer logs in namespaces or Pods matched label you select.</p>
<p>The sample CR like <code>Forward logs in my-project namespace to Elasticserach which is deployed by Cluster Logging</code> could be as follows:</p>
<pre><code>apiVersion: &quot;logging.openshift.io/v1&quot;
kind: ClusterLogForwarder
metadata:
  name: instance 
  namespace: openshift-logging 
spec:
  inputs: 
   - name: my-app-logs
     application:
        namespaces:
        - my-project
  pipelines:
   - name: my-app 
     inputRefs:
      - my-app-logs
     outputRefs:
      - default
</code></pre>
<p>You can customize <code>inputs</code> field as you want. It also could be specified Pods using <code>matchLabels</code> expression. *2</p>
<p>outputs <code>default</code> means send logs to <code>default</code> Elasticsearch on Cluster Logging.</p>
<p>*1: <a href="https://docs.openshift.com/container-platform/4.11/logging/cluster-logging-external.html" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/4.11/logging/cluster-logging-external.html</a></p>
<p>*2: <a href="https://docs.openshift.com/container-platform/4.7/logging/cluster-logging-external.html#cluster-logging-collector-log-forward-logs-from-application-pods_cluster-logging-external" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/4.7/logging/cluster-logging-external.html#cluster-logging-collector-log-forward-logs-from-application-pods_cluster-logging-external</a></p>
