CRI-O container logs truncate lines after 8192 characters in Red Hat OpenShift Container Platform

Solution In Progress - Updated -

Issue

Cri container logs truncate lines after 8192 characters in Red Hat OpenShift Container Platform

This can easily be reproduced. Create the following pod - pod.yaml:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: testlog
  name: testlog
spec:
  containers:
  - command:
      - "sh"
      - "-c"
      - "cat $filetoprint; sleep 120"
    image: busybox
    name: testlog
    env:
    - name: filetoprint
      value: '/tmp/filetoprint'
    volumeMounts:
    - name: filetoprint
      mountPath: /tmp
  volumes:
  - name: filetoprint
    configMap:
      name: filetoprint
  dnsPolicy: ClusterFirst
  restartPolicy: Never

Create the following configmap - configmap.yaml:

apiVersion: v1
data:
  filetoprint: |
    1#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-log#this-is-a-test-l(... this line is ca. 10000 characters long ...)
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: filetoprint
oc apply -f configmap.yaml
oc apply -f pod.yaml

The logs as reported by Kubernetes show 1 line and 10078 characters:

[root@openshift-jumpserver-0 02721322]# oc logs teslog | wc
      1       1   10078

But when connecting to the worker node and looking at the container logs as stored by CRI-O:

[root@openshift-worker-0 ~]# wc /var/log/pods/02721322_testlog_68897ba0-f34b-4ad4-9197-72eecc001036/testlog/0.log
    2     8 10169 /var/log/pods/02721322_testlog_68897ba0-f34b-4ad4-9197-72eecc001036/testlog/0.log
[root@openshift-worker-0 ~]# cut -b 1-80 /var/log/pods/02721322_testlog_68897ba0-f34b-4ad4-9197-72eecc001036/testlog/0.log
2020-08-06T10:35:37.979242514+00:00 stdout P 1#this-is-a-test-log#this-is-a-test
2020-08-06T10:35:37.979337456+00:00 stdout F -a-test-log#this-is-a-test-log#this
[root@openshift-worker-0 ~]# 

Environment

Red Hat OpenShift Container Platform 4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content