Bug 1866681

Summary: Cluster Log Forwarder: the labels added in pipelines are not added to the log messages.
Product: OpenShift Container Platform Reporter: Qiaoling Tang <qitang>
Component: LoggingAssignee: IgorKarpukhin <ikarpukh>
Status: CLOSED ERRATA QA Contact: Qiaoling Tang <qitang>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: aos-bugs
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 15:09:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fluent.conf none

Description Qiaoling Tang 2020-08-06 06:14:46 UTC
Created attachment 1710603 [details]
fluent.conf

Description of problem:

Create a CLF instance:
  spec:
    outputs:
    - name: es-server
      type: elasticsearch
      url: http://elasticsearch-server-elasticsearch.apps.qitang.example.com:80
    pipelines:
    - inputRefs:
      - infrastructure
      - application
      - audit
      labels:
        logging-labels: test-labels
      name: forward-to-es-server
      outputRefs:
      - es-server
  status:
    conditions:
    - lastTransitionTime: "2020-08-06T05:14:39Z"
      status: "True"
      type: Ready
    inputs:
      application:
      - lastTransitionTime: "2020-08-06T05:14:39Z"
        status: "True"
        type: Ready
      audit:
      - lastTransitionTime: "2020-08-06T05:14:39Z"
        status: "True"
        type: Ready
      infrastructure:
      - lastTransitionTime: "2020-08-06T05:14:39Z"
        status: "True"
        type: Ready
    outputs:
      es-server:
      - lastTransitionTime: "2020-08-06T05:14:39Z"
        status: "True"
        type: Ready
    pipelines:
      forward-to-es-server:
      - lastTransitionTime: "2020-08-06T05:14:39Z"
        status: "True"
        type: Ready

check the logs received in the elasticsearch server, the logs don't have the labels defined in the pipelines:

$ curl http://elasticsearch-server-elasticsearch.apps.qitang.example.com/app-write/_search?pretty -H 'Content-Type: application/json' -d '
{
   "size": 2,
   "sort": [
      {"@timestamp": {"order":"desc"}}
   ]
}'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 162,
    "max_score" : null,
    "hits" : [
      {
        "_index" : "app-write",
        "_type" : "_doc",
        "_id" : "OGJiMzc4YmUtZWE1OS00OGZiLWI1YzItNzBiY2Y3YTUxYjg4",
        "_score" : null,
        "_source" : {
          "docker" : {
            "container_id" : "e047fb1e48dc7459e2f7d3050d2a1421f90dcbbab67f9df1320e1543a90afacb"
          },
          "kubernetes" : {
            "container_name" : "log4j2",
            "namespace_name" : "qitang",
            "pod_name" : "log4j2-65455dfc6-nzxbw",
            "container_image" : "quay.io/qiaolingtang/generate-log:latest",
            "container_image_id" : "quay.io/qiaolingtang/generate-log@sha256:cf3f78ae1f8aedeb0ed296b97fcdc19f35633ef568717d4a30e9a746fb8f7a96",
            "pod_id" : "1d8c96be-6e34-4716-8b32-194842af4907",
            "host" : "ip-10-0-205-166.us-east-2.compute.internal",
            "master_url" : "https://kubernetes.default.svc",
            "namespace_id" : "93bfe0ac-3fe8-429d-ae35-26a87e11eee0",
            "flat_labels" : [
              "name=log4j2",
              "pod-template-hash=65455dfc6"
            ]
          },
          "message" : "{\"message\": \"MERGE_JSON_LOG=true\", \"testcase\": \"logging-test\", \"level\": \"debug\",\" Layer1\": \"layer1 0\", \"layer2\": {\"name\":\"Layer2 1\", \"tips\":\"decide by PRESERVE_JSON_LOG\"}, \"StringNumber\":\"10\", \"Number\": 10,\"foo.bar\":\"dotstring\",\"{foobar}\":\"bracestring\",\"[foobar]\":\"bracket string\", \"foo:bar\":\"colonstring\", \"empty1\":\"\", \"empty2\":{}}",
          "level" : "unknown",
          "hostname" : "ip-10-0-205-166.us-east-2.compute.internal",
          "pipeline_metadata" : {
            "collector" : {
              "ipaddr4" : "10.0.205.166",
              "inputname" : "fluent-plugin-systemd",
              "name" : "fluentd",
              "received_at" : "2020-08-06T05:28:12.862977+00:00",
              "version" : "1.7.4 1.6.0"
            }
          },
          "@timestamp" : "2020-08-06T05:28:11.901180+00:00",
          "viaq_msg_id" : "OGJiMzc4YmUtZWE1OS00OGZiLWI1YzItNzBiY2Y3YTUxYjg4"
        },
        "sort" : [
          1596691691901
        ]
      },

I can't find the labels configurations in the fluent.conf, adding/removing labels field doesn't trig a new deployment of fluentd pods.


Version-Release number of selected component (if applicable):
clusterlogging.4.6.0-202008051928.p0
ose-cluster-logging-operator-v4.6.0-202008051928.p0

How reproducible:
100%

Steps to Reproduce:
1. deploy logging operators
2. deploy a log receiver
3. create CLF
4. create clusterlogging
5. check logs received in the log receiver

Actual results:


Expected results:
should add
  "openshift" : {
    "labels" : {
      "logging-labels": "test-labels"
    }
  }
to the logs 

Additional info:

Comment 3 Qiaoling Tang 2020-08-24 07:58:35 UTC
Verified with clusterlogging.4.6.0-202008202200.p0

Comment 5 errata-xmlrpc 2020-10-27 15:09:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6.1 extras update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4198