我想将一些日志消息发送到远程日志服务器,并将其上的设施更改为configuration的值,以便日志服务器可以更轻松地告诉他们来自我的硬件。 也就是说,所有从我的机器出来的日志都是local3,无论它们的原始设施如何。
我可以用FreeBSD的vanilla syslogd来做这个,或者使用其他的实现吗?
显然,使用FreeBSD系统日志是不可能的。 我已经在手册页上寻找任何线索,什么都没find。
根据这个网页,你可以用syslog-ng来完成,但是我们没有办法切换。
正如Andrew自己发现的那样,syslog-ng将是最好的select。
但是我认为,甚至在使用vanilla FreeBSD syslogd的时候,可能会有一种非常糟糕的方式来实现这个诀窍。 似乎可以将日志条目pipe道传输到外部程序:然后,可以将消息传送到logger
并使用它设置所需设施和优先级,并要求logging器将日志条目发送到日志服务器。
logging器可能会将自己的时间戳等添加到每个日志条目,所以你可能想sed
或任何原始的时间戳。
是的,我知道,这种方法会很糟糕,属于“不要试试这种任何地方”类别,但它仍然有效。
我想你试图做一些奇怪的事情。 您可以根据它们来自的主机名轻松地对syslog中的消息进行sorting。
请参阅man syslog.conf
:
A hostname specification of the form #+hostname or +hostname means the following blocks will be applied to messages received from the speci- fied hostname. Alternatively, the hostname specification #-hostname or -hostname causes the following blocks to be applied to messages from any host but the one specified. If the hostname is given as @, the local hostname will be used. As for program specifications, multiple comma-separated values may be specified for hostname specifications.