Uploaded image for project: 'OpenShift Logging'
  1. OpenShift Logging
  2. LOG-6368

Can not add labels under spec.pipelines section of ClusterLogForwarder with RHOL v6

XMLWordPrintable

    • False
    • None
    • False
    • NEW
    • NEW
    • Release Note Not Required
    • Log Collection - Sprint 262

      Description of problem:

      -Can not add labels parameter in ClusterLogForwarder configuration while forwarding logs to any destination while using RHOL v6.
      -Starting with RHOL v6 we can not mention labels under spec.pipelines section of ClusterLogForwarder.

      Version-Release number of selected component (if applicable):

      -Red Hat Openshift Logging 6.0.0, Red Hat Openshift Logging 6.0.1

      How reproducible:

      Steps to Reproduce:

      1. Install RHOCP Cluster (4.14+)
      2. Install Cluster Logging Operator (v6.0.0, v6.0.1)
      3. Install Lokistack Operator if logs are forwarded to Loki (v6.0.0, v6.0.1)
      4. Install Cluster Observability Operator.
      5. Create the Service Account:
      $ oc -n openshift-logging create serviceaccount collector

      Create the Cluster Role Binding for the Service Account:

      $ oc create clusterrolebinding collect-application-logs --clusterrole=collect-application-logs --serviceaccount openshift-logging:collector
      $ oc create clusterrolebinding collect-infrastructure-logs --clusterrole=collect-infrastructure-logs --serviceaccount openshift-logging:collector
      $ oc create clusterrolebinding collect-audit-logs --clusterrole=collect-audit-logs --serviceaccount openshift-logging:collector

      Bind the writer Cluster Role to the Service Account:

      $ oc adm policy add-cluster-role-to-user logging-collector-logs-writer -z collector

      6. Deploy the UIPlugin to enable the log section:

      $ cat << EOF |oc create -f -
      apiVersion: observability.openshift.io/v1alpha1
      kind: UIPlugin
      metadata:
        name: logging
      spec:
        type: Logging
        logging:
          lokiStack:
             name: logging-loki
      EOF

       

      7. As per the object storage, create a secret with the correct details and mention it in the Lokistack Custom resource. Once all lokistack pods come running deploy CLF with following config:

      8.Deploy the ClusterLogForwarder observability Custom Resource:

       

      $ cat << EOF |oc create -f -
      apiVersion: observability.openshift.io/v1
      kind: ClusterLogForwarder
      metadata:
        name: instance
        namespace: openshift-logging
      spec:
        serviceAccount:
          name: collector
        outputs:
        - name: default-lokistack
          type: lokiStack
          lokiStack:
            target:
              name: logging-loki
              namespace: openshift-logging
            authentication:
              token:
                from: serviceAccount
          tls:
            ca:
              key: service-ca.crt
              configMapName: openshift-service-ca.crt
        pipelines:
        - name: default-logstore
          inputRefs:
          - application
          - infrastructure
          outputRefs:
          - default-lokistack
          labels:
            myLabel: "myValue"
      EOF

       

      9. Check the ClusterLogForwarder observability Custom Resource again to validate if labels parameter is still part of the configuration.

      Actual results:

      Admission Webhook Warning
       
      ClusterLogForwarder instance violates policy 299 - "unknown field \"spec.pipelines[0].lables\""

      -Labels parameter is automatically vanishes after creating the ClusterLogForwarder observability Custom Resource.

      Expected results:

      -Labels should applied to log records passing through this pipeline.
      -These labels need to appear in the `openshift.labels` map in the log record.

      Additional info:

      -With RHOL v5.9 and <, It is possible to mention labels parameter in the ClusterLogForwarder configuration:

      $ oc explain clf.spec.pipelines.labels
      
      GROUP:      logging.openshift.io
      KIND:       ClusterLogForwarder
      VERSION:    v1
      FIELD: labels <map[string]string>
      DESCRIPTION:
          Labels applied to log records passing through this pipeline.
          These labels appear in the `openshift.labels` map in the log record.

       

      -With RHOL v6.0:

      $ oc explain obsclf.spec.pipelines
      
      GROUP:      observability.openshift.io
      KIND:       ClusterLogForwarder
      VERSION:    v1
      FIELD: pipelines <[]Object>
      DESCRIPTION:
          Pipelines forward the messages selected by a set of inputs to a set of
          outputs.
          PipelineSpec links a set of inputs and transformations to a set of outputs.
          
      FIELDS:
        filterRefs    <[]string>
          Filters lists the names of filters to be applied to records going through
          this pipeline.
          
          Each filter is applied in order.
          If a filter drops a records, subsequent filters are not applied.
        inputRefs    <[]string> required
          InputRefs lists the names (`input.name`) of inputs to this pipeline.
          
          The following built-in input names are always available:
          
           - `application` selects all logs from application pods.
          
           - `infrastructure` selects logs from openshift and kubernetes pods and some
          node logs.
          
           - `audit` selects node logs related to security audits.
        name    <string> required
          Name of the pipeline
        outputRefs    <[]string> required
          OutputRefs lists the names (`output.name`) of outputs from this pipeline.

       

      Kindly let me know if you need any other information.

              cahartma@redhat.com Casey Hartman
              rhn-support-pripatil Prithviraj Patil
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: