需要使用 Node.js 进行 SysLog 的建议
我刚刚 npm install node-syslog 但它不起作用。
我有一个系统日志服务器(IP 地址和 local0)。
我正在寻找一个系统日志模块来帮助我将消息发布到系统日志。但我不知道我应该使用哪一个。请给我一些建议。谢谢。
哦..如果有一个好的系统日志解析器(node.js),也请告诉我。 :)
I have just npm install node-syslog but it doesn't work.
I have a syslog server (IP address , and local0).
And I'm looking for a syslog module to help me post the message to syslog. But I don't know which one I should use. Please give me some suggestion. thanks.
oh.. if there is a good syslog parser (node.js), please let me know too. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
syslog-stream 使用本机 C 绑定为 syslog 创建可写流。它还包括测试。
然后,您可以直接写入该流或作为另一个日志记录模块的输出。
syslog-stream creates a writable Stream for syslog using native C bindings. It also includes tests.
You could then write to that stream directly or as an output for another logging module.
社区似乎尚未就此达成共识。我遇到的每个节点系统日志项目都有长期悬而未决的问题,这些问题似乎非常重要(或者是鬼城)。
Winston 似乎是通用日志记录的最佳选择,并且具有可用的 Winston-syslog 传输。问题是它似乎存在一些非常重要的问题: https://github.com/ indexzero/winston-syslog/issues
我想我要亲自尝试一下winston-syslog-ain2。
It doesn't look like the community has come to a consensus here. Each of the node syslog projects I've come across have long-open issues that seem pretty significant (or are ghost towns).
Winston seems to be the best option for general-purpose logging and has the winston-syslog transport available. The problem is that there seem to be some pretty significant issues with it: https://github.com/indexzero/winston-syslog/issues
I think I'm going to give winston-syslog-ain2 a shot, myself.
和你一样,我也在寻找系统日志解决方案,直到我发现这个观点:
https://adam.herokuapp.com/past/2011/4/1/ logs_are_streams_not_files/
现在我很高兴地结束了我的搜索并正在使用
console.log
。Like you, I was also searching for a syslog solution until I found this opinion:
https://adam.herokuapp.com/past/2011/4/1/logs_are_streams_not_files/
Now I've happily concluded my search and am using
console.log
.我都用过
和
没有任何问题。
但是当我处于你的情况时,我运行:
我运行了 npm search syslog ,这是我的输出,希望它有所帮助。
I've used both
and
without any issues.
But when I'm in your situation I run:
I ran npm search syslog and this is my output, hope it helps.
我尝试了 npm 搜索中列出的大部分模块,但对其中任何一个都没有什么运气。
幸运的是,最后我偶然发现了 rconsole 我发现它更容易使用配置和使用比任何其他人都要好。
它也很好,它允许您在开发过程中对标准输出进行着色和时间戳(以及跟踪等)。
要使用,只需
npm i rconsole
,然后,从文档中:在 OSX 上,我使用
tail -f /var/log/system.log
检查我的系统日志I tried most of the modules listed in npm search, and had very little luck with any of them.
Luckily in the end, I stumbled across rconsole which I found was MUCH easier to configure and use than any of the others.
It's also nice that it allows you to colour and timestamp (and trace, etc) your stdout during development.
To use, simply
npm i rconsole
, then, from the docs:On OSX, I check my syslog using
tail -f /var/log/system.log