Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-3084

Pod logs: Long lines are corrupted when using timestamps=true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • 4.8
    • Unknown
    • None
    • 3
    • OCPNODE Sprint 227 (Green), OCPNODE Sprint 228 (Green), OCPNODE Sprint 229 (Green), OCPNODE Sprint 230 (Green), OCPNODE Sprint 231 (Green), OCPNODE Sprint 232 (Green)
    • 6
    • False
    • Hide

      None

      Show
      None

      Upstream Issue: https://github.com/kubernetes/kubernetes/issues/77603

      Long log lines get corrupted when using '--timestamps' by the Kubelet.

      The root cause is that the buffer reads up to a new line. If the line is greater than 4096 bytes and '--timestamps' is turrned on the kubelet will write the timestamp and the partial log line. We will need to refactor the ReadLogs function to allow for a partial line read.

      https://github.com/kubernetes/kubernetes/blob/f892ab1bd7fd97f1fcc2e296e85fdb8e3e8fb82d/pkg/kubelet/kuberuntime/logs/logs.go#L325

      apiVersion: v1
      kind: Pod
      metadata:
        name: logs
      spec:
        restartPolicy: Never
        containers:
        - name: logs
          image: fedora
          args:
          - bash
          - -c
          - 'for i in `seq 1 10000000`; do echo -n $i; done'
      
      kubectl logs logs --timestamps
      

            rphillip@redhat.com Ryan Phillips
            rphillip@redhat.com Ryan Phillips
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 3 minutes
                3m
                Remaining:
                Remaining Estimate - 3 minutes
                3m
                Logged:
                Time Spent - Not Specified
                Not Specified