写入输出流 3(stdout 或 stderr)
是否可以写入第三个输出流?我的情况是,我有许多脚本可以跨机器网格远程执行各种命令。这些命令会产生 stdout 和 stderr。然而,我想将进度反馈给中央控制机器,而不使其与网格中各种机器的交错标准输出和标准错误混淆。我在想,如果可以写入第三个输出流,我可以将它用于网格中的特定状态事件,控制脚本可以报告,同时 stdout 和 stderr 可以保持重定向到日志文件以进行调试出问题了。 无论如何,我可能会在 ruby 中实现这一点,并且涉及的机器将是 Windows 和 UNIX 机器的混合体。
Is it possible to write to a 3rd output stream? My situation is that I have an a number of scripts that execute various commands, remotely across a grid of machines. Those commands result in stdout and stderr. I would however like to feedback progress to the central controlling machine, without cluttering it with the interlaced stdout and stderr of the various machines in the grid. I was thinking that if it is possible to write to a 3rd output stream, that I could use it for specific status events from the grid, that the controlling script can report on, meanwhile stdout and stderr can remain redirected to log files for debugging should something go wrong.
For what it is worth I will probably be implementing this in ruby, and the machines involved will be a mixture of windows and unix machines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为您构建日志记录的方式受到您使用的语言的限制,但是 log4r 和 <如果您选择使用 ruby,就会想到 href="http://angryruby.blogspot.com/2007/08/ruby-and-syslog.html" rel="nofollow">syslog 。如果您需要一个真正的多平台解决方案,也许您可能会考虑某种消息总线或ØMQ,尽管这会产生额外的费用层的复杂性。
听起来像所有脚本写入的信息和错误的通用日志文件可能是最简单的解决方案。鉴于您管理的是许多小流程而不是一个大型整体应用程序,使用 Splunk 这样的工具可能会有所帮助汇总和分析所有记录的事件。
I don't think how you architect your logging is constrained by the language you're using, but log4r and syslog come to mind if you're set on ruby. If you need a truly multiplatform solution maybe you might consider some kind of message bus or ØMQ although this will incur an extra layer of complexity.
It sounds like common logfiles for info and errors that all your scripts write to might be the simplest solution. Seeing as you're managing lots of small processes rather than one big monolithic app, using a tool like Splunk might help to aggregate and analyse all the logged events.