Open richardcase opened 2 years ago
It's clear it has to be a stream because it can be huge. How should the stream behave? Close the connection on EOF (option A) or keep the file open (option B) and send new content and the connection is closed on error or when the client closes it?
So simplified version without propagating the error or anything fancy checking:
go func() {
for {
select {
case <-ctx.Done():
return
default:
}
bytes := make([]byte, 2014)
length, err := file.Read(bytes)
if err != nil {
if err != io.EOF {
logrus.Error(err.Error())
return
}
// Options A:
//select {
//case end <- true:
//default:
//}
//return
// Option B:
time.Sleep(time.Microsecond * 100)
continue
}
stream.Send(&api.TailResponse{Data: bytes[:length]})
}
}()
Or add a "keep reading" flag on the request.
This issue is stale because it has been open 60 days with no activity.
Still valid.
This issue was closed because it has been stalled for 365 days with no activity.
Describe the solution you'd like: It would be good if there was an API endpoint that would be called to get the stdout/stderr of the Firecracker instance.
Why do you want this feature: Its handy for debugging and operational reasons. And also in the future we could expose this via a UI.
Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]