我需要将消息从一个日志文件转发到另一个IP,比如127.0.0.1 514
。我该如何做到这一点?
我在rsyslog的文档中使用了这个例子:
module(load="imfile" PollingInterval="10") #needs to be done just once
# File 2
input(type="imfile"
File="/path/to/file2"
Tag="tag2")
以及为其提供以下规则:
*.* @127.0.0.1:514
但这最终发送了系统的所有日志,包括日志。
那么,如何正确使用规则集、输入块和*.* @127.0.0.1:514
将日志从文件/path/to/file2
发送到127.0.0.1:514
呢?
感谢
指定输入时,还要说明要应用的规则集。规则集不会处理规则集之外的输入。
module(load="imfile")
input(type="imfile" File="/path/to/file2" Tag="tag2" ruleset="remote")
ruleset(name="remote"){
action(type="omfwd" target="127.0.0.1" port="514" protocol="udp")
# or use legacy syntax:
# *.* @127.0.0.1:514
}