New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Websocket endpoint for service logs #35324
Comments
@cghislai can you tell what is your use case here? What will web-socket solve for you? Thanks. |
I can't use the hijacking technique to gather container/service logs in a web browser javascript context. Websockets however are already handled by most web browsers and web servers. No special technique is required and existing libraries could be leveraged to gather logs. |
@thaJeztah @boaz0 |
Logs don't hijack the tcp connect, IIRC. What I'd like to see is for the API to not use this stream format if a single stream (egg stdout) was requested. Then you can make two requests, one for each stream. |
btw, the attach endpoint for websockets has always looked wrong to me since everything seems to be sent down a single stream and there is no way to differentiate stdout from stderr. |
@cpuguy83 const http = require('http');
http.get('http://127.0.0.1:8080/containers/d2cf357d5602918f3dfbd50e7a7f37f72788a42091eb46856e890329a2628877/logs?stdout=1&follow=1', (resp) => {
let data = '';
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
console.log(data.toString('utf8'));
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log();
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
its work corretly since there no conn Hijack, |
I'm not saying that attach should grab the container or service logs. What I am saying is:
|
There is already a websocket endpoint to attach to a container.
Now that service logs are available in the API, I'd be happy to be able to use websocket to fetch them.
Hijacking a TCP connection is not something we can easily do in a browser.
The text was updated successfully, but these errors were encountered: