我目前正在使用rsyslog将我的所有系统日志发送到SQL服务器,它运行正常。 但是我的一台计算机将它发送到一种不同的格式。 如何为给定的IP地址设置例外?
这是我现在所拥有的:
$template sysMysql,"INSERT INTO logs (host,facility, priority,level,tag,datetime,program,msg) VALUES('%HOSTNAME%','%syslogfacility-text%','%syslogpriority-text%','%syslogseverity%','%syslogtag%','%timereported:::date-mysql%','%programname%', '%msg%')", SQL
*.*;authpriv.none;mail.none;cron.none >127.0.0.1,centreon_syslog,centreon_syslog,*****;sysMysql
我想只为一个IP地址更改该模板。
答案 0 :(得分:0)
好的,我在这里找到了一些东西:answer 但要完成,这就是我必须做的事情:
$template sysMysqlUcopia,"INSERT INTO logs (host,facility, priority,level,tag,datetime,program,msg) VALUES('portailcaptif','%syslogfacility-text%','%syslogpriority-text%','%syslogseverity%','%syslogtag%','%timereported:::date-mysql%','%programname%', '%msg%')", SQL
$template sysMysql,"INSERT INTO logs (host,facility, priority,level,tag,datetime,program,msg) VALUES('%HOSTNAME%','%syslogfacility-text%','%syslogpriority-text%','%syslogseverity%','%syslogtag%','%timereported:::date-mysql%','%programname%', '%msg%')", SQL
:fromhost-ip, isequal, "172.17.97.60" >127.0.0.1,centreon_syslog,centreon_syslog,*****;sysMysqlUcopia
& ~
*.*;authpriv.none;mail.none;cron.none >127.0.0.1,centreon_syslog,centreon_syslog,*****;sysMysql