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.
I followed this documentation: https://docs.openshift.com/container-platform/4.7/logging/cluster-logging.html
I'm using fluentd as the log collector.
As Cluster Logging on OpenShift, you can transfer logs in namespaces or Pods matched label you select.
The sample CR like
Forward logs in my-project namespace to Elasticserach which is deployed by Cluster Loggingcould be as follows:You can customize
inputsfield as you want. It also could be specified Pods usingmatchLabelsexpression. *2outputs
defaultmeans send logs todefaultElasticsearch on Cluster Logging.*1: https://docs.openshift.com/container-platform/4.11/logging/cluster-logging-external.html
*2: 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