apocas / dockerode

Docker + Node = Dockerode (Node.js module for Docker's Remote API)
Apache License 2.0
4.38k stars 465 forks source link

Docker logs Demuxing #511

Closed thelamer closed 5 years ago

thelamer commented 5 years ago

It looks like in a recent update if "follow" is set to false when grabbing container logs you get back a buffer. That is fine, but even converted to utf8 I am having trouble figuring out a reliable method of removing just the logstream for parsing, used to use "ansi_up.ansi_to_html" in combination with the demuxed logStream to parse it to a reliable readable output.

Does anyone have any suggestions or are there any plans to add a function call to demux this buffer?

mhemrg commented 5 years ago

Same issue after upgrading to 2.5.8 from 2.5.3. Seems that this issue is related to #456 and #469.

apocas commented 5 years ago

Update dockerode's dependency docker-modem to v1.0.9 (just published it)

It should fix the problem.

thelamer commented 5 years ago

When you say it should fix the problem are you saying we can use the same container.modem.demuxStream function call on the return from an unfollowed logset? Updated I still get a buffer and if I try to put that through demux I get a no trace crash.

Sorry I gotta go full pleb status here, do you have a modified example of this without following the output https://github.com/apocas/dockerode/blob/master/examples/logs.js ?

larshp commented 5 years ago

Having similar issue, using 2.5.8

thelamer commented 5 years ago

closing as it is not the responsibility of the maintainer to give me code examples.