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

loki labelKeys with slashes break in 5.7

XMLWordPrintable

    • False
    • None
    • False
    • NEW
    • VERIFIED
    • Hide
      Before this change ClusterLogForwarder loki outputs with label keys that included slashes would cause the collector to crashloop. This corrects that behavior to properly replace slashes with underscores so the collector can start and properly set the loki label
      Show
      Before this change ClusterLogForwarder loki outputs with label keys that included slashes would cause the collector to crashloop. This corrects that behavior to properly replace slashes with underscores so the collector can start and properly set the loki label
    • Bug Fix
    • Log Collection - Sprint 237, Log Collection - Sprint 238
    • Moderate

      Description of problem:

      Related to #1790 which enabled labelKeys with `.` and `/`. This feature is now broken in 5.7 (I haven't checked 5.6)

      Given this log forwader:

      apiVersion: logging.openshift.io/v1
      kind: ClusterLogForwarder
      metadata:
        name: instance
        namespace: openshift-logging
      spec:
        outputs:
         - name: central-loki 
           type: "loki" 
           url: ...
           secret:
             name: central-loki
           loki:
            labelKeys:
              - log_type
              - kubernetes.namespace_name
              - kubernetes.pod_name
              - kubernetes.host
              - kubernetes.container_name
              - tag
              - kubernetes.labels.application
              - kubernetes.labels.foo/bar
        pipelines:
         - name: all-logs
           detectMultilineErrors: true
           inputRefs:
            - application
           outputRefs:
            - central-loki
      

      The resulting configmap for the collector has this line:

      [sinks.central_loki.labels]
      kubernetes_container_name = "{{kubernetes.container_name}}"
      kubernetes_host = "${VECTOR_SELF_NODE_NAME}"
      kubernetes_labels_application = "{{kubernetes.labels.application}}"
      # the following line breaks the collector
      kubernetes_labels_foo/bar = "{{kubernetes.labels.foo/bar}}" 
      kubernetes_namespace_name = "{{kubernetes.namespace_name}}"
      kubernetes_pod_name = "{{kubernetes.pod_name}}"
      log_type = "{{log_type}}"
      tag = "{{tag}}"
      

      *Environment*

      • OpenShift 4.12
      • Cluster Logging Operator 5.7.0

      *Logs*

      The collector instances complain about "vector::cli invalid character '/'".

      *Expected behavior*

      The labelKeys keep working.

            jcantril@redhat.com Jeffrey Cantrill
            jcantril@redhat.com Jeffrey Cantrill
            Kabir Bharti Kabir Bharti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: