如何在 OSX 中启用 syslogd 从路由器接收 UDP 日志
有时路由器会坏,我想获取路由器日志。
虽然有些路由器具有内置日志查看器,但有些则没有。 大多数路由器似乎都有使用系统日志将日志发送到另一台主机的功能。
如何让 OSX(客户端)接收这些日志? OSX 有一个 syslogd,但指令充其量是不透明的。
也许不同的客户端应用程序会更好,但我更喜欢一种无需通过互联网下载刚刚崩溃的工具即可进行破解的方法...
OSX 本身没有 netcat,否则我会尝试这样做。
Occasionally a router goes bad and I would like to get the router logs.
While some routers have built-in log viewers, some do not. Most routers seem to have a facility to send logs to another host using syslog.
How do I get OSX (client) to receive these logs? OSX has a syslogd, but the instructions are opaque at best.
Perhaps a different client application would be better, but I'd prefer a way I could just hack up without downloading tools across the internet that has just broken down...
OSX does not have netcat, natively, otherwise I would have tried that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用可能适用于 OS X 的 syslog-ng,虽然我不确定,但我使用以下 3 行通过家庭网络从我的 wifi 路由器捕获系统日志消息到我的日志服务器:
然后将 wifi 路由器配置为使用记录服务器的 IP 地址和 wifirouter 标识符。 您可以修改源行以仅接受来自某些源 IP 地址的信息。
Using syslog-ng which is probably available for OS X, although I am not certain, I capture syslog messages over my home network from my wifi router to my log server with the following 3 lines:
The wifi router was then configured to use use the log server's IP address and the wifirouter identifier. You could modify the source line to accept from only certain source IP addresses.
对于现有的 Mac OS syslogd,所需的“魔法”如下。
编辑 syslogd 的 launchd 配置,/System/Library/LaunchDaemons/com.apple.syslogd.plist(您需要是 root 用户,或者使用“sudo vi”或您最喜欢的其他方法来编辑此配置) 。)
(某些版本似乎已经注释掉了必要的部分,但我的一个版本没有。)
在以下内容之后:
添加或取消注释(删除前导“”行),此部分:
然后重新启动 syslogd完全(即使用 launchctl,再次以 root 身份)
(我认为这个问题/答案可能属于 superuser.com?也许有人可以将其移过去。)
The required "magic", with the stock Mac OS syslogd, is as follows.
Edit the launchd config for syslogd, /System/Library/LaunchDaemons/com.apple.syslogd.plist (you will need to be root, or use 'sudo vi' or your favourite other method to edit this.)
(Some versions seem to already have the necessary section commented out, but one of mine didn't.)
After the following:
add in, or uncomment (remove the leading "" lines), this section:
and then restart the syslogd completely (i.e. using launchctl, again as root)
(I think this question/ answer probably belongs on superuser.com? Maybe someone can move it over.)
仅供参考,可以使用 XCode 套件附带的属性列表编辑器来编辑二进制 plist 文件,也可以使用第 3 方编辑器 Text Wrangler。 我还没有尝试过,但考虑到它与 TextWrangler 的血统,我怀疑 BBEdit 也能够编辑它。
FYI, binary plist files can be edited using either the Property List Editor included with the XCode suite, or you can use the 3rd party editor Text Wrangler. I've not tried it, but I suspect BBEdit would be able to edit it as well considering it's lineage with TextWrangler.
从 OS X 10.7 及更高版本开始,您应该参考此 StackOverflow 答案来了解此问题。
From OS X 10.7 and above you should refer to this StackOverflow answer for this question.