func (l *AuditLog) GetSessionChunk(sid session.ID, offsetBytes, maxBytes int) ([]byte, error) {
	log.Debugf("audit.log: getSessionReader(%v)", sid)
	fstream, err := os.OpenFile(l.sessionStreamFn(sid), os.O_RDONLY, 0640)
	if err != nil {
		log.Warning(err)
		return nil, trace.Wrap(err)
	}
	defer fstream.Close()

	// seek to 'offset' from the beginning
	fstream.Seek(int64(offsetBytes), 0)

	// copy up to maxBytes from the offset position:
	var buff bytes.Buffer
	io.Copy(&buff, io.LimitReader(fstream, int64(maxBytes)))

	return buff.Bytes(), nil
}
// GetSessionChunk returns a reader which console and web clients request
// to receive a live stream of a given session. The reader allows access to a
// session stream range from offsetBytes to offsetBytes+maxBytes
//
GetSessionChunk returns a reader which console and web clients request
to receive a live stream of a given session. The reader allows access to a
session stream range from offsetBytes to offsetBytes+maxBytes
// GetSessionChunk returns a reader which console and web clients request // to receive a live stream of a given session . The reader allows access to a // session stream range from offsetBytes to offsetBytes + maxBytes //
func (l *AuditLog) GetSessionChunk(sid session.ID, offsetBytes, maxBytes int) ([]byte, error) {
	log.Debugf("audit.log: getSessionReader(%v)", sid)
	fstream, err := os.OpenFile(l.sessionStreamFn(sid), os.O_RDONLY, 0640)
	if err != nil {
		log.Warning(err)
		return nil, trace.Wrap(err)
	}
	defer fstream.Close()
	fstream.Seek(int64(offsetBytes), 0)
	var buff bytes.Buffer
	io.Copy(&buff, io.LimitReader(fstream, int64(maxBytes)))
	return buff.Bytes(), nil
}
func ( l * AuditLog ) GetSessionChunk ( sid session . ID , offsetBytes , maxBytes int ) ( [ ] byte , error ) { log . Debugf ( " " , sid ) fstream , err := os . OpenFile ( l . sessionStreamFn ( sid ) , os . O_RDONLY , 0640 ) if err != nil { log . Warning ( err ) return nil , trace . Wrap ( err ) } defer fstream . Close ( ) fstream . Seek ( int64 ( offsetBytes ) , 0 ) var buff bytes . Buffer io . Copy ( & buff , io . LimitReader ( fstream , int64 ( maxBytes ) ) ) return buff . Bytes ( ) , nil }
GetSessionChunk returns a reader which console and web clients request
to receive a live stream of a given session.
GetSessionChunk returns a reader which console and web clients request to receive a live stream of a given session .
// seek to 'offset' from the beginning // copy up to maxBytes from the offset position: