Bug 1838055

Summary: fluentd run.sh expr: division by zero after upgrade when techPreview Logforward enabled
Product: OpenShift Container Platform Reporter: Anping Li <anli>
Component: LoggingAssignee: Periklis Tsirakidis <periklis>
Status: CLOSED ERRATA QA Contact: Anping Li <anli>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.5CC: anisal, aos-bugs, ikarpukh, periklis
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: LogForwarding Outputs result in zero outputs if none pass the validation checks. Fluentd checks the number of outputs to reserve buffer space on the node's filesystem. The zero outputs result in the division by zero. Consequence: Fluentd' run script fails and the pod remains in CLBO Fix: Default fluentd's NUM_OUTPUTS to 1 if no outputs provided. Result: No fluentd in CBLO. Logs collected on node's FS until buffers are full or valid outputs provided.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:40:29 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
fluentd configmap
none
fluentd run.sh debug logs none

Description Anping Li 2020-05-20 12:25:03 UTC
Description of problem:
upgrade from 4.4 to 4.5, fluentd expr: division by zero.

$oc logs fluentd-lgnhd
expr: division by zero
run.sh: line 103: [: too many arguments
expr: syntax error
run.sh: line 108: [: too many arguments

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

How reproducible:
Always

Steps to Reproduce:
1. Install clusterlogging.4.4.0-202005180840.
2. Enable TechPreview Logforward.

kind: LogForwarding
metadata:   
  name: instance   
  namespace: openshift-logging
spec:   
  outputs:     
    - name: elasticsearch-default
      type: elasticsearch
      endpoint: 'elasticsearch.openshift-logging.svc:9200'
      secret:
         name: 'fluentd'
    - name: fluentd-created-by-user
      type: forward
      endpoint: 'fluentdserver.openshift-logging.svc:24224'
      secret:
         name: 'fluentdserver'
  pipelines:
    - name: app-pipeline
      inputSource: logs.app
      outputRefs:
        - elasticsearch-default
    - name: infra-pipeline
      inputSource: logs.infra
      outputRefs:
        - fluentd-created-by-user
    - name: audit-pipeline
      inputSource: logs.audit
      outputRefs:
        - fluentd-created-by-user


3. Enable Configmap syslog forward
 <store>
     @type syslog
     remote_syslog 172.30.66.248
     port 514
     hostname $hostname
     remove_tag_prefix tag
     tag_key ident,systemd.u.SYSLOG_IDENTIFIER
     facility local0
     severity info
     use_record true
     payload_key message
    </store>
4. Upgrade to 4.5.

Actual results:
expr: division by zero. Please refer to the attached ConfigMap and fluent debug Log

Expected results:


Additional info:

Comment 1 Anping Li 2020-05-20 12:26:40 UTC
Created attachment 1690217 [details]
fluentd configmap

Comment 2 Anping Li 2020-05-20 12:27:46 UTC
Created attachment 1690229 [details]
fluentd run.sh debug logs

Comment 5 Anping Li 2020-06-01 09:10:27 UTC
Verified using elasticsearch-operator.4.5.0-202005301517 and clusterlogging.4.5.0-202005302117

Comment 6 errata-xmlrpc 2020-07-13 17:40:29 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, 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:2409

Comment 8 Periklis Tsirakidis 2020-09-04 07:25:10 UTC
@Apurva

A solution [1] is awaiting to get picked up in the the 4.4 z-stream as part of [2] 

[1] https://github.com/openshift/cluster-logging-operator/pull/674
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1861224