Python 客户端/服务器实时传输日志文件更新?

发布于 2024-12-06 12:45:32 字数 427 浏览 6 评论 0原文

我们在 Solaris 10 服务器上有生成文本日志文件的应用程序。我们需要将这些日志文件实时传输到中央服务器以监控新事件。

理想情况下,我们有一个 NFS 挂载,我们所有的系统都会将日志写入那里,监控服务器可以从那里提取它们。不幸的是,由于技术和非技术原因,这不是一个选择。

目前,我们使用后台 tail -f 通过 SSH 隧道传输数据。

然而,我们正在考虑是否值得将一些更强大的东西组合在一起。

我正在考虑使用 Twistedb(或类似的东西 - 建议?)编写一个简单的 Python 客户端/服务器来流式传输日志数据。这是很容易就能实现的事情吗?我可以从现有的库/工具中寻找想法吗?有什么我应该注意的问题吗?

另外,这是 Solaris 10,所以我不熟悉文件系统监视器的状态。我知道 Gamin 可以通过 OpenCSW 获得。但是,还有其他选择吗?

We have applications on Solaris 10 servers that generate text logfiles. We need to stream these logfiles in realtime to a central server for monitoring of new events.

Ideally we'd have a NFS-mount, and all our system would write their logs to there, and the monitoring server could just pull them up from there. Unfortunately, for technical and non-technical reasons that's not an option here.

At the moment, we're using a backgrounded tail -f to pipe the data over an SSH tunnel.

However, we were looking at whether it's worth putting together something a bit more robust.

I was thinking of writing a simple Python client/server with Twistedb (or something similar - recommendations?) to stream the log data. Is this something that's easily achievable? Any existing libraries/tools I could look to for ideas? Any issues I should be aware of?

Also, this is Solaris 10, so I'm not familiar with the state of filesystem monitors. I do know Gamin is available via OpenCSW. however, are there any other choices out there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空心空情空意 2024-12-13 12:45:32

查看 Python 的日志记录模块。 http://docs.python.org/library/logging.html

它包含以下功能记录到文件、流、系统日志、网络服务器等。该食谱包含示例或通过网络进行日志记录。 http://docs.python.org/howto/logging-cookbook.html #logging-cookbook

该模块也相当容易扩展。

Check out Python's logging module. http://docs.python.org/library/logging.html

It contains the capability to log to files, streams, syslog, networked servers, and more. The cookbook contains examples or logging over the network. http://docs.python.org/howto/logging-cookbook.html#logging-cookbook

The module is fairly easy to extend also.

吝吻 2024-12-13 12:45:32

请考虑使用 zeromq,而不是原始套接字。它不是消息代理服务器,而是一个让您编写消息传递系统的库。它可以通过 TCP、IPC(是的,进程间!)、多播和其他协议轻松实现跨平台和与语言无关的通信。只需将 python 组件替换为 C 组件,它就可以像以前一样工作。

它是满足您“..借口学习..”需求的完美软件;-)

但最精彩的部分是在您的 Solaris 设置中构建它。 Python 绑定位于 http://pypi.python.org/pypi/pyzmq/2.1.9

Do consider zeromq, instead of raw sockets. Its no message broker server, its a library to let you write your message passing system. It enables easy cross-platform and language-agnostic communication over TCP, IPC (yes,inter-process!), multicast and other protocols. Simply swap a python component with a C component and it just works as before.

Its the perfect software to satisfy your "..excuse to learn.." ;-)

But the show-stopper would be building it in your Solaris setup. Python bindings are at http://pypi.python.org/pypi/pyzmq/2.1.9

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文