#问题背景:
通过欧拉操作系统的rsyslog服务实现对指定日志文件的日志实时上传到syslog服务器
rsyslog版本为:rsyslogd 8.2210.0
#问题现象
在/etc/rsyslog.d文件夹下创建02-rsyslog.conf配置文件,文件内容为:
input(type="imfile"
File="/opt/cbsvs/logs/cosign/business_20250806.log"
Tag="myapp-log:"
Severity="info"
Facility="local7"
PersistStateInterval="100"
ReadMode="2"
)
action(type="omfwd"
Target="192.168.2.194"
Port="514"
Protocol="udp"
Template="RSYSLOG_Tradit
上述为配置文件,已加载imfile模块,这样远程服务器可以接收
但是这个配置文件有缺陷,会把指定日志文件外的日志上传到远程服务器,我想只上传指定日志文件的日志到远程服务器于是配置了如下配置:
input(type="imfile"
File="/opt/cbsvs/logs/cosign/business_20250806.log"
Tag="myapp-log:"
Severity="info"
Facility="local7"
PersistStateInterval="100"
ReadMode="2"
)
if $syslogtag == "myapp-log:" then {
action(type="omfwd"
Target="192.168.2.194"
Port="514"
Protocol="udp"
Template="RSYSLOG_TraditionalFileFormat"
)
stop
}
重启rsyslog后不起作用,通过rsyslogd -N1 -f /etc/rsyslog.d/02-rsyslog.conf命令出现rsyslogd: error during parsing file /etc/rsyslog.d/02-nginx.conf, on or before line 9: parameter 'readTimeout' not known -- typo in config file? [v8.2210.0 try https://www.rsyslog.com/e/2207 ] 这个该如何解决