def strip_docker_header( self, line ):

        # the docker header has a stream id, which is a single byte, followed by 3 bytes of padding
        # and then a 4-byte int in big-endian (network) order
        fmt = '>B3xI'
        size = struct.calcsize( fmt )

        # make sure the length of the line has as least as many bytes required by the header
        if len( line ) >= size:
            stream, length = struct.unpack( fmt, line[0:size] )

            # We expect a value of 0, 1 or 2 for stream.  Anything else indicates we don't have
            # a docker header
            # We also expect length to be the length of the remaining line
            if stream in [ 0, 1, 2 ] and len( line[size:] ) == length:
                #We have a valid docker header, so strip it
                line = line[size:]

        return line
Docker prepends some lines with an 8 byte header.  The first 4 bytes a byte containg the stream id
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/docker_monitor.py/DockerLogger.strip_docker_header