可以使用stdout / stderr作为流利的源吗?

时间:2019-02-20 02:45:44

标签: fluentd

问题:

是否可以将stdout / stderr用作流利的源代码?
如果没有,是否有某种解决方法可以实现?

背景:

我必须对使用json-log作为日志记录资源的NodeJS Web服务器进行容器化。
由于容器是短暂的,因此我想提取其日志以进行调试。
为此,我决定使用EFK堆栈。

但是,因为...

  

json-log的理念是...

     

写入标准输出/错误

我只能从stdout获取Web服务器的日志。
在浏览了流利的文档之后,我没有找到使用stdout / stderr作为源的方法。

相关问题:

Is it possible to use stdout as a fluentd source to capture specific logs for write to elasticsearch?
这个问题有答案,但对我而言不适用。

1 个答案:

答案 0 :(得分:0)

请参见https://www.npmjs.com/package/json-log#write-to-stdouterr

您可以将日志从json-log发送到syslog。 因此,您可以使用fluent-plugin-syslog从json-log接收日志,并将其发送到Fluentd。