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

Vector in CrashLoopBackOff when using matchLabel containing slash

XMLWordPrintable

    • False
    • None
    • False
    • NEW
    • VERIFIED
    • Hide
      Before this change clusterlogforwarder input matchlabels that contained a slash and relied upon vector would result in an invalid configuration and the the collector would crashloop. This change addresses the issue by properly quoting the match label to allow the collector to start and collect logs
      Show
      Before this change clusterlogforwarder input matchlabels that contained a slash and relied upon vector would result in an invalid configuration and the the collector would crashloop. This change addresses the issue by properly quoting the match label to allow the collector to start and collect logs
    • Bug Fix
    • Log Collection - Sprint 237
    • Important

      Description of problem:

      Vector is in CrashLoopBackOff when it's used the feature matchLabel containing character / as:

      spec:
        inputs:
        - application:
            selector:
              matchLabels:
                local.test/logtype: user
          name: myAppLogData 

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

      $ oc get csv
      NAME                            DISPLAY                            VERSION   REPLACES                        PHASE
      cluster-logging.v5.6.5          Red Hat OpenShift Logging          5.6.5     cluster-logging.v5.6.4          Succeeded
       

      How reproducible:

      Always

      Steps to Reproduce:

      1. Configure the  CLO for using Vector as Log collector
        $ oc get clusterlogging instance -o yaml 
        apiVersion: logging.openshift.io/v1
        kind: ClusterLogging
        metadata:
          creationTimestamp: "2023-05-12T12:41:27Z"
          generation: 2
          name: instance
          namespace: openshift-logging
          resourceVersion: "8134555"
          uid: 28fcbd55-13b9-4f3e-861e-6211795ff1c9
        spec:
          collection:
            logs:
              type: vector
            type: vector
        
      1.  Configure clusterLogForwarder to use `matchLabel` containing the character /
        $ oc get clusterlogforwarder instance -o yaml 
        apiVersion: logging.openshift.io/v1
        kind: ClusterLogForwarder
        [...]
        spec:
          inputs:
          - application:
              selector:
                matchLabels:
                  local.test/logtype: user   
            name: myAppLogData
          pipelines:
          - inputRefs:
            - myAppLogData
            name: container-logs
            outputRefs:
            - default
        [...]
        
      1. Check the Vector collector pods in CrashLoopbackoff status:
        $ oc get pods -l component=collector
        NAME              READY   STATUS             RESTARTS        AGE
        collector-45pwm   1/2     CrashLoopBackOff   6 (4m37s ago)   10m
        collector-czssk   1/2     CrashLoopBackOff   6 (4m43s ago)   10m
        collector-dv8xf   1/2     CrashLoopBackOff   6 (4m42s ago)   10m
        collector-mghps   1/2     CrashLoopBackOff   6 (4m49s ago)   10m
        collector-vp7nh   1/2     CrashLoopBackOff   6 (4m45s ago)   10m
        collector-zkf48   1/2     CrashLoopBackOff   6 (4m48s ago)   10m
        
      1. Check the error given in the collectors related to the matchLabel
        $ oc logs collector-45pwm 
        Defaulted container "collector" out of: collector, logfilesmetricexporter
        2023-05-12T12:54:21.368864Z  WARN vector::config::loading: Transform "route_container_logs._unmatched" has no consumers
        2023-05-12T12:54:21.368892Z  WARN vector::config::loading: Transform "route_application_logs._unmatched" has no consumers
        2023-05-12T12:54:21.417131Z ERROR vector::topology: Configuration error. error=Transform "route_application_logs": 
        error[E701]: call to undefined variable
          ┌─ :1:31
          │
        1 │ .kubernetes.labels.local.test/logtype == "user"
          │                               ^^^^^^^
          │                               │
          │                               undefined variable
          │                               did you mean "true"?
          │
          = see language documentation at https://vrl.dev
        
        error[E100]: unhandled error
          ┌─ :1:1
          │
        1 │ .kubernetes.labels.local.test/logtype == "user"
          │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          │ │
          │ expression can result in runtime error
          │ handle the error case to ensure runtime success
          │
          = see documentation about error handling at https://errors.vrl.dev/#handling
          = learn more about error code 100 at https://errors.vrl.dev/100
          = see language documentation at https://vrl.dev
        

      Actual results:

      Vector pods are in continuous `CrashLoopBackOff` status

      Expected results:

      Vector pods run and they are configured to collecting only the logs for the pods matching the `matchLabel`.

      Additional info:

            jcantril@redhat.com Jeffrey Cantrill
            rhn-support-ocasalsa Oscar Casal Sanchez
            Kabir Bharti Kabir Bharti
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: