使用node.js将日志发送到网页

时间:2014-04-06 13:28:42

标签: node.js stream docker

我在尝试将我的应用程序的一些日志发送到前面时遇到了问题。

我想将特定docker容器的所有日志发送到网页。我可以将它附加到它完美运行的控制台中,但我无法将此流发送到一个简单的网页,该网页将显示容器中发生的事情。

我该怎么做?

我已经尝试过使用socket.io但是我总是遇到一个循环JSON错误,所有我可以到达前端的是[object Object]而没有别的。

这是我用来附加容器的功能:

docker.containers.attach(containerId, {logs: true, stream: true, stdout: true, stderr: false, tty: false}, function(err, stream){
  stream.pipe(process.stdout); //This shows what happens inside the container. I want to send this output to a web page
})

0 个答案:

没有答案
相关问题